0

Eclipse Juno、JSF、および PrimeFaces (OS Debian) を使用して、単純な動的 Web プロジェクトを作成しました。アプリケーションを JBoss AS 7.1 サーバー (スタンドアロン) にデプロイしました。無料のページがあります: インデックス、追加、連絡先。私のナビゲーション ルールは次のとおりです。すべてがうまく機能しますが、追加ページと連絡先ページからインデックスに移動できません。Web ブラウザー (Google Chrome) を更新した場合にのみインデックス ページが表示されます。誰かが同じ問題を抱えていますか?私はそれを検索しましたが、解決策は見つかりませんでした。助けてくれてありがとう。ここに私のファイルがあります:
web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">

<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>excite-bike</param-value>
</context-param>
<display-name>Example2</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
    <welcome-file>add.xhtml</welcome-file>
    <welcome-file>contact.xhtml</welcome-file>

</welcome-file-list>
<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>*.xhtml</url-pattern>
</servlet-mapping>
<servlet>
    <description>JAX-RS Tools Generated - Do not modify</description>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <servlet-class></servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>JAX-RS Servlet</servlet-name>
    <url-pattern>/jaxrs/*</url-pattern>
</servlet-mapping>


顔-config.xml:

    <managed-bean>
    <managed-bean-name>addBean</managed-bean-name>
    <managed-bean-class>web.AddBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <managed-bean>
    <managed-bean-name>menuBean</managed-bean-name>
    <managed-bean-class>web.MenuBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <navigation-rule>
   <from-view-id>/index.xhtml</from-view-id>
   <navigation-case>
  <from-outcome>add</from-outcome>
  <to-view-id>/add.xhtml</to-view-id>
  </navigation-case>
  <navigation-case>
  <from-outcome>contact</from-outcome>
  <to-view-id>/contact.xhtml</to-view-id>
  </navigation-case>
  </navigation-rule>
  <navigation-rule>
  <from-view-id>/add.xhtml</from-view-id>
  <navigation-case>
  <from-outcome>home</from-outcome>
  <to-view-id>/index.xhtml</to-view-id>
  </navigation-case>
  <navigation-case>
  <from-outcome>contact</from-outcome>
  <to-view-id>/contact.xhtml</to-view-id>
  </navigation-case>
 </navigation-rule>
<navigation-rule>
<from-view-id>/contact.xhtml</from-view-id>
 <navigation-case>
 <from-outcome>add</from-outcome>
 <to-view-id>/add.xhtml</to-view-id>
</navigation-case>
<navigation-case>
 <from-outcome>home</from-outcome>
 <to-view-id>/index.xhtml</to-view-id>
</navigation-case>


MenuBean.java:

package web;
import javax.annotation.ManagedBean;
import javax.enterprise.context.ApplicationScoped;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class MenuBean {
public String home(){return "home";}
public String add(){return "add";}
public String contact(){return "contact";}}
               <br>

.xhtml ページのメニューのコード:

<h:form>
            <p:tabMenu activeIndex="1">
                <p:menuitem value="HOME" icon="ui-icon-star"
                    action="#{menuBean.home()}" />
                <p:menuitem value="ADDS" icon="ui-icon-document"
                    action="#{menuBean.add()}" />
                <p:menuitem value="CONTACT" icon="ui-icon-person"
                    action="#{menuBean.contact()}" />

            </p:tabMenu>
        </h:form>
4

1 に答える 1