Thanks guys for your replies. Well I found a soultion for this. In web.xml I specified this URL pattern.
<servlet-mapping>
<servlet-name>Faces
Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<session-config>
which removes the faces in start and converts the .jsp extenssion to .faces. Then I made a filter so that each request is first passed from that filter which is
<filter>
<filter-name>URLFilter</filter-name>
<filter-class>com.soft.autohaul.Filter.URLFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>URLFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
which means any request will first pass through the URLFilter class which as follows
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class URLFilter implements Filter {
public void destroy() {
// TODO Auto-generated method stub
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub
HttpServletRequest httpServletRequest = ((HttpServletRequest)request);
String dispatchURL =((HttpServletRequest)request).getServletPath()+".faces";
try{
httpServletRequest.getRequestDispatcher(dispatchURL).forward(request, response);
}catch(Exception e){
}
}
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
}
Si if I want to visit "first.jsp". I will write only "first" in browser without the extenssion. The request will go to filter which will add the ".faces" extenssion to it. After that the request will be dispatched to faces Servlet.
Hope it helps others.