java.lang.UnsupportedOperationException jsf

haobohuiying 2010-05-30 02:02:20
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
<f:view>
<h:form id="loginForm">
<h:panelGrid columns="3">
<f:facet name="caption">
<h:outputText value="#{bundle.title_login}"></h:outputText>
</f:facet>
<h:outputText value="#{bundle.login_userName }"/>
<h:inputText id="textName" value="#{registrationBean.username }" required="true"/>
<h:message for="testName" style="color:red"/>

<h:outputText value="#{bundle.login_password}"/>
<h:inputSecret id="textPwd" value="#{registrationBean.password}" required="true">
<f:validateLength minimum="6" maximum="20"></f:validateLength>
</h:inputSecret>
<h:message for="textPwd" style="color:red"></h:message>
<f:facet name="footer">
<h:panelGroup>
<h:commandButton value="#{bundle.button_submit}" action="#{registrationBean.validate}"/>
<h:outputText value=""/>
<h:commandButton value="#{bundel.button_reset}" type="reset"/>
</h:panelGroup>
</f:facet>
</h:panelGrid>
</h:form>

</f:view>

</body>
</html>

success.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
<f:view>
<h2>
<h:outputText value="#{bundle.success_welcome}"></h:outputText>
<h:outputText value="#{registrationBean.userName}"></h:outputText>
</h2>
<jsp:useBean id="currentDate" class="java.util.Date" scope="request"></jsp:useBean>
<h:outputText value="#{currenDate}">
<f:convertDateTime type="both"/>
</h:outputText>
</f:view>

</body>
</html>


failure.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>

<body>
<f:view>
<h2>
<h:outputText value="#{bundle.failure_error}"></h:outputText>
</h2>
<h:messages style="color:red"></h:messages>
<h:outputLink value="/index.jsp">
<h:outputText value="#{bundle.button_back}"></h:outputText>
</h:outputLink>
<jsp:useBean id="currentDate" class="java.util.Date" scope="request"></jsp:useBean>
<h:outputText value="#{currenDate}">
<f:convertDateTime type="both"/>
</h:outputText>
</f:view>

</body>
</html>


faces-config.jsp

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>registrationBean</managed-bean-name>
<managed-bean-class>com.RegistrationBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/success.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/failure.jsp</to-view-id>
</navigation-case></navigation-rule>
<application>
<message-bundle>com.ApplicationMessage</message-bundle>
<locale-config>
<default-locale>zh_CN</default-locale>
<supported-locale>en_US</supported-locale>
<supported-locale>zh_TW</supported-locale></locale-config>
<resource-bundle>
<base-name>com.ApplicationMessage</base-name>
<var>bundle</var>
</resource-bundle>
</application>

</faces-config>

web.jsp
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>

总是报这个异常,其高手指点,急急急啊!

2010-5-30 13:35:15 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet FacesServlet threw exception
java.lang.UnsupportedOperationException
at javax.faces.application.Application.getResourceHandler(Application.java:286)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:307)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

请高手指点!
...全文
494 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
momi 2010-05-30
  • 打赏
  • 举报
回复
你上面写的faces-config.jsp,不是faces-config.xml?
momi 2010-05-30
  • 打赏
  • 举报
回复
所有的url指的是什么呢?web工程下每个url,包括静态html吗?
你的url运行的是
http://localhost:8080/test/a.jsp
还是
http://localhost:8080/test/a.jsf
这样的呢?
haobohuiying 2010-05-30
  • 打赏
  • 举报
回复
所有的url都是这个错误!我检查了都有get方法!
momi 2010-05-30
  • 打赏
  • 举报
回复
1.是哪个页面报错,请列出url。
2.请检查你的每个EL表达式是否正确。方法是否存在?成员变量是否有get方法?

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧