[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
[Home]
Does URL Rewriting work with GnuJSP?
I'm using vqserver with GnuJSP and am trying to get URL Rewriting to
work without any success.
It works fine with servlets, but not with JSPs and servlets. Does
URL rewriting work with JSPs?
This is what I'm doing
x.jsp has a reference to a servlet x.java
...
<a href="/servlet/x">ID</a>
...
The service() method of x.java has the following
HttpSession session = request.getSession(true);
...
session.putValue("id", new String("foo"));
RequestDispatcher dispatch = getServletContext().
getRequestDispatcher("/jsp/y.jsp");
dispatch.forward(request, response);
y.jsp has a reference to a servlet y.java
...
<a href=<%= response.encodeURL("/servlet/y")%>>Details</a>
...
The service() method of y.java has the following
HttpSession session = request.getSession(true);
...
String id = (String)session.getValue("id")
But I lose the session created in the servlet x.
I have tried changing
RequestDispatcher dispatch = getServletContext().
getRequestDispatcher("/jsp/y.jsp");
to
RequestDispatcher dispatch = getServletContext().
getRequestDispatcher(response.encodeURL("/jsp/y.jsp"));
but that didn't work.
I get the session created in the servlet x in y.jsp. But I lose it between y.jsp and the
servlet y.
Am I doing something wrong here?
If I try to do all the rendering in the servlets without using jsps, URW Rewriting works just
fine between the x.java and y.java servlets.
Any pointers?
Regards
Milind