I made a simple application named Sport. When I test it, the home page (index.xhtml) displays correctly, and the URL is:http://localhost:8080/Sport
When I click an item in the navigation menu, for example Teams, the requested page (teams.xhtml) displays correctly, but the URL looks like this:http://localhost:8080/Sport/index.html;jsessionid=C9B3379254D6E21A6A2EA90775710108
After that, I click another item, for example Stadiums. The page stadiums.xhtml displays, but the URL is:http://localhost:8080/Sport/teams.xhtml
This behaviour goes on. It looks like the URL is always one step behind the actual page.
menu.xhtml:
...
<h:commandLink value="#{msgs.home}" action="home" />
<h:commandLink value="#{msgs.teams}" action="teams" />
<h:commandLink value="#{msgs.stadiums}" action="stadiums" />
...
faces-config.xml:
...
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
<redirect/>
</navigation-rule>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>stadiums</from-outcome>
<to-view-id>/stadium.xhtml</to-view-id>
</navigation-case>
<redirect/>
</navigation-rule>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>teams</from-outcome>
<to-view-id>/team.xhtml</to-view-id>
</navigation-case>
<redirect/>
</navigation-rule>
...
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Use Documents Saved as *.xhtml -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</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>*.xhtml</url-pattern>
<!--<url-pattern>/faces/*</url-pattern>-->
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
I'm using JSF2.2 library (in NetBeans 7.4).
Any ideas?