facebook

Newbie question. Unable to forward to an .xhtml file

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #294569 Reply

    gbadavidson
    Member

    I am a newbie and need a little help. I am trying to do a simple <jsp:forward…> and I keep getting a 404 resource not found. I have added the jsf-facelts.jar file to the lib directory. The project is using Eclipse with My Eclipse Version: 3.4.1
    Build id: M20080911-1700 with MyEclipse 2.0.1 running on Tomcat 6.0.18.

    My web.xml is:
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app xmlns=”http://java.sun.com/xml/ns/javaee&#8221; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; version=”2.5″ xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”&gt;
    <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <!–Tomcat 5 Workaround: Listener used to initialize JSF on startup–>

    <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>

    <!–Tomcat 5 Workaround: Listener implementation to handle web application lifecycle event–>

    <listener>
    <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>
    </listener>

    </web-app>

    My index.jsp is:
    <%@ page language=”java” import=”java.util.*” pageEncoding=”ISO-8859-1″%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <body>
    <jsp:forward page=”/index.faces”></jsp:forward>

    </body>
    </html>

    The index.xhtml is in the same subdirectory as the index.jsp

    #294576 Reply

    Loyal Water
    Member

    Im not sure. Maybe some other users on this forum could help you with this.

    #294581 Reply

    gbadavidson
    Member

    Do you have a simple sample app that does the “forward” to an xhtml file correctly. I downloaded a sample called MyBlog and it when the “.faces” call is made it fails with the same 404 error.

    #294610 Reply

    gbadavidson
    Member

    I want to apologize for taking your time earlier. It seems I had a bit of a brain malfunction….

    The problem I discovered was related to Tomcat, specificlly that I had installed tomcat 5.5 and set the Catalina_Home environmental variable for that version. I subsequently loaded Tomcat 6 but did not update the environmental variable. So I found myself in a situation where Tomcat was not operating as expected. When I adjusted the environmental variable the problem ceased to exist.

    #294641 Reply

    Loyal Water
    Member

    Glad you got the issue sorted out.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Newbie question. Unable to forward to an .xhtml file

You must be logged in to post in the forum log in