JSF 2在WebSphere 7.0中不起作用

时间:2014-08-21 08:58:21

标签: maven jsf-2 primefaces websphere-7

我们使用的是JSF-2.0.3,Primefaces 5.0。     页面重定向在WAS 7.0中不起作用,并且在Tomcat 6.0中正常工作。不工作,我的意思是,页面被重定向,数据不被渲染。

任何人都可以帮助。

faces-config.xml中:

<navigation-rule>
        <display-name>login.xhtml</display-name>
        <from-view-id>/login.xhtml</from-view-id>
        <navigation-case>
            <display-name>main.xhtml</display-name>
            <to-view-id>/main.xhtml</to-view-id>
            <redirect />
        </navigation-case>
    </navigation-rule>
    <navigation-rule>
        <display-name>main.xhtml</display-name>
        <from-view-id>/main.xhtml</from-view-id>
        <navigation-case>
            <display-name>tab.xhtml</display-name>
            <to-view-id>/tab.xhtml</to-view-id>
            <redirect />
        </navigation-case>
    </navigation-rule>

使用以下方式重定向:

FacesContext.getCurrentInstance().getExternalContext().redirect("tab.jsf");

的web.xml:

<context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>afterwork</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
  <welcome-file-list>
    <welcome-file>login.jsf</welcome-file>
    </welcome-file-list>
    <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>resources.application</param-value>
    </context-param>
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

的pom.xml

    <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.0.3</version>
        </dependency>
        <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.0</version>
        </dependency>
        <dependency>
       <groupId>com.sun.facelets</groupId>
       <artifactId>jsf-facelets</artifactId>
       <version>1.1.14</version>
    </dependency>
        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>afterwork</artifactId>
            <version>1.0.10</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>

         <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient-cache</artifactId>
                <version>4.2.2</version>
            </dependency>

我希望配置问题,任何人都可以建议

1 个答案:

答案 0 :(得分:1)

com.sun.faces(jsf-api)是来自mojarra而不是myfaces的库。 Websphear默认使用myfaces。 您应该将websphear服务器配置为使用mojarra而不是myfaces。 我不知道Webspher 7和8.5之间有什么不同,但我过去常常配置出现在link

上的Websphear 8.5