moving in directory structure through servlet
843841Sep 22 2003 — edited Sep 24 2003Hi everyone,
I am currently using this directory structure and have 2 web applications "myweb1" and "myweb2".
/myweb1/jsp pages
/myweb1/WEB-INF
/myweb1/WEB-INF/classes
/myweb1/WEB-INF/classes/myservlet
/myweb1/WEB-INF/lib
/myweb2/display.jsp
/myweb2/WEB-INF
/myweb2/WEB-INF/classes
/myweb2/WEB-INF/lib
I have a servlet named "myservlet" in WEB-INF/classes directory(myweb1 application) as shown above. I have following entries in my web.xml file of "myweb1" webapplication.
<servlet>
<servlet-name>myservlet</servlet-name>
<display-name>myservlet</display-name>
<servlet-class>com.abc.servlet.myservlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/myservlet</url-pattern>
</servlet-mapping>
This whole application is running fine. Now I need to forward user from "myservlet" to "display.jsp" page in myweb2 application.
I am using this line in "myservlet" file.
getServletConfig().getServletContext().getRequestDispatcher("../myweb2/display.jsp").forward(request, response);
however this line is not working. Can anyone suggest me how to access display.jsp file from myservlet.
Thanks.
Rahul