日期:2014-05-18  浏览次数:20813 次

jsf初学者问题
2007-5-31   10:54:00   javax.faces.webapp.UIComponentTag   setupResponseWriter
严重:   Faces   context   not   found.   getResponseWriter   will   fail.   Check   if   the   FacesServlet   has   been   initialized   at   all   in   your   web.xml.


web.xml
<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<web-app   xmlns= "http://java.sun.com/xml/ns/j2ee "   xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance "   version= "2.4 "   xsi:schemaLocation= "http://java.sun.com/xml/ns/j2ee       http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
    <context-param>
        <param-name> javax.faces.CONFIG_FILES </param-name>
        <param-value> /WEB-INF/faces-config.xml </param-value>
    </context-param>
    <listener>
        <listener-class> org.apache.myfaces.webapp.StartupServletContextListener </listener-class>
    </listener>
    <servlet>
        <servlet-name> Faces   Servlet </servlet-name>
        <servlet-class> javax.faces.webapp.FacesServlet </servlet-class>
        <load-on-startup> 0 </load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name> Faces   Servlet </servlet-name>
        <url-pattern> *.faces </url-pattern>
    </servlet-mapping>
    <filter>
        <filter-name> MyFacesExtensionsFilter </filter-name>
        <filter-class> org.apache.myfaces.component.html.util.ExtensionsFilter </filter-class>
        <init-param>
            <param-name> maxFileSize </param-name>
            <param-value> 20m </param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name> MyFacesExtensionsFilter </filter-name>
        <url-pattern> *.faces </url-pattern>
    </filter-mapping>
</web-app>

faces-config.xml
<?xml   version= "1.0 "   encoding= "UTF-8 "?>
<!DOCTYPE   faces-config   PUBLIC   "-//Sun   Microsystems,   Inc.//DTD   JavaServer   Faces   Config   1.1//EN "   "http://java.sun.com/dtd/web-facesconfig_1_1.dtd ">

<faces-config   >
<managed-bean>
<managed-bean-name> user </managed-bean-name>
<managed-bean-class> org.hzc.User </managed-bean-class>
<managed-bean-scope> session </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> /welcome.jsp </to-view