java.lang.UnsupportedOperationException jsf
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)
请高手指点!