hello
i have a
jsp:include and forward problem
the scenario is as follows.
i have two JSP files and one
servlet files.
In the First File say "index.jsp" i am including one servlet file say "ServletTest". and in the included servlet file i am forwarding to the other jsp file say "test.jsp" but i am getting an error javax.servlet.ServletException
i am working on
j2ee ri 1.3.1... please reply soon me really stuck
thanks
alot !!
-----------------------------------------------
<!--content of index.jsp:-->
<jsp:include page="/ServletTest"/>
------------------------------------------------
//content of ServletTest.java:
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* @Author heinzli
*/
public class ServletTest extends HttpServlet
{
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
System.out.println("servlet");
RequestDispatcher rd = getServletContext().getRequestDispatcher("/test.jsp");
rd.forward(request,response);
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
doPost(request,response);
}
}
------------------------------------------------
<!--content of test.jsp:-->
<br>i m return file.<br>
----------------------------------------------
<!--web.xml-->
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>ServletTest</servlet-name>
<servlet-class>ServletTest</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ServletTest</servlet-name>
<url-pattern>/ServletTest</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
heinzli
[ May 21, 2002: Message edited by: Christian Lee ]