Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_java thread: How my Tomcat can't find JSP


Message #1 by Edward <zhangsc@n...> on Tue, 04 Jun 2002 16:18:42 +0800
  I use Tomcat to deploy JSP named "menu.jsp",I want to call JSP from Servlet.
//Servlet named "myservlet.java"
  public void doPost(HttpServletRequest request,HttpServletResponse response) 
     throws ServletException,IOException
 {
    .....
    getServletConfig().getServletContext().getRequestDispatcher
       ("/login/servlet/jsp/menu.jsp").forward(request,response);
    ...
 }

//JSP named "menu.jsp"
<html>
<body>
  <H1>I have recieve your message</H1>
</body>
</html>

I put my files into follow directories:
D:\Apache Tomcat 4.0\webapps\login\WEB-INF\jsp\menu.jsp
D:\Apache Tomcat 4.0\webapps\login\WEB-INF\classes\myservlet.class
D:\Apache Tomcat 4.0\webapps\login\WEB-INF\web.xml
D:\Apache Tomcat 4.0\webapps\login\servlets\index.html

//web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
    <servlet>
        <servlet-name>
           myservlet
        </servlet-name>
        <servlet-class>
           myservlet
        </servlet-class>
    </servlet>
    <session-config>
     <session-timeout>
        30
     </session-timeout>
    </session-config>
    <welcome-file-list>
     <welcome-file>
        index.html
     </welcome-file>
     <welcome-file>
            menu.jsp
        </welcome-file>
    </welcome-file-list>
</web-app>   

When I call menu.jsp from servlet,it got a error:
Apache Tomcat/4.0.1 - HTTP Status 404 - /menu.jsp

type Status report
message /login/servlet/jsp/menu.jsp
description The requested resource (/login/servlet/jsp/menu.jsp) is not available.

I have put menu.jsp into D:\Apache Tomcat 4.0\webapps\login\WEB-INF\jsp\menu.jsp, Why it still error?
Thanks in advance!
Edward

  Return to Index