I am new to JSF and starting to explore it and I have created a simple login application using jsf, when i try to run it via apache tomcat server, it is displaying fine in the browser but the problem is when i give the credentials and try to login it is displaying the correct content of the page but the URL is like this JSF_Sample_2/faces/Login.jsp and it has to be JSF_Sample_2/faces/Success.jsp and while displaying also it is showing only upto the application name like this JSF_Sample_2/
My web.xml is
<?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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>JSF_Sample_2</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</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>/faces/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>faces/Login.jsp</welcome-file>
</welcome-file-list>
</web-app>
My faces-config.xml is
<?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>loginFormBean</managed-bean-name>
<managed-bean-class>
com.Lawrence.JSF.LoginFormBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/Login.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-case>
<from-outcome>home</from-outcome>
<to-view-id>/Login.jsp</to-view-id>
</navigation-case>
</navigation-rule> </faces-config>
My Managed Bean is
package com.Lawrence.JSF;
public class LoginFormBean
{
private String userName;
private String passWord;
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getPassWord()
{
return passWord;
}
public void setPassWord(String passWord)
{
this.passWord = passWord;
}
public String doLogin()
{
if(getUserName().equals("Lawrence") && getPassWord().equals("lawrence"))
{
return "success";
}
else
{
return "Failure";
}
}
public String logOut()
{
return "home";
}
}
and in the success page as well as failure page i am using commandlink where action is given as loginformbean.logOut which takes back to the login page but that is also not working and i have written navigation rule in faces-config rule Please help me to solve this problems