Hello: I am getting a failure in my code when using a request dispatcher to forward the request to an encoded url from a post operation.
To see it in action, do the following: 1. Turn off cookies on your browser 2. Visit http://dev.jammconsulting.com/gen?_template=/index.jsp 3. Hit the Test button. You will get this error: HTTP Status 404 - /gen;jsessionid=BF99242CF6F9E32C44D50EACE5576AD5 ------------------------------------------------------------------------ -------- type Status report message /gen;jsessionid=BF99242CF6F9E32C44D50EACE5576AD5 description The requested resource (/gen;jsessionid=BF99242CF6F9E32C44D50EACE5576AD5) is not available. ------------------------------------------------------------------------ -------- Apache Tomcat/4.1.27 Now, turn on cookies and try it again. You will get a page that states: This is compose.jsp Session id is BFBC13C89DD4B3F5A98EF8E53F0D6A45 I thought that Tomcat is supposed to act the same with cookies on or off when I use encodeURL on all of my urls. Here is the code behind this sample: In httpd.conf, ask apache to map all urls that begin with /gen into tomcat: <LocationMatch /gen> JkUriSet worker ajp13:localhost:8009 </LocationMatch> In tomcat server.xml, I told tomcat that the root context uses my app: <Context path="" docBase="email" debug="0"/> In my app's web.xml, told it to map all request for /gen to my test servlet: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>sls</servlet-name> <servlet-class> servlet.TestServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>sls</servlet-name> <url-pattern>/gen/*</url-pattern> </servlet-mapping> <session-config> <session-timeout>50</session-timeout> </session-config> </web-app> Here is my test servlet, which forwards all requests to the appropriate template: package servlet; import java.io.*; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; public class TestServlet extends HttpServlet { private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { getServletContext().getRequestDispatcher(request.getParameter("_template ")).forward(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request,response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request,response); } } Here is the index.jsp template, which posts to the massCompose template: <P> Session id is <%= session.getId() %> <P> <form name=groupList method="post" action="<%= response.encodeUrl("/gen") %>"> <input type=hidden name="_template" value="/massCompose.jsp"> <input type="submit" value="test"> </form> Here is the massCompose template which forwards to the compose template: <% RequestDispatcher rdispatch = request.getRequestDispatcher(response.encodeURL("/gen?_template=/compose .jsp&type=normal")); rdispatch.forward(request, response); %> Here is the compose template which just displays a message: <HTML> <BODY> This is compose.jsp <P> Session id is <%= session.getId() %> <P> </BODY> </HTML> Any ideas why this is occurring? Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (972)612-6056, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! => http://newsletter.JAMMConsulting.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]