passing an attribute after "redirect"
Hello,
I need to pass a String from one jsp to another
but Ihave to use response.sendRedirect("http://servname:8080/App2");
unfortunately I cannot use the URL passing (with the ?) because it is information which has to be hidden.
Even putting it in session or application:
session.setAttribute("sname","value");
application.setAttribute("aname","value");
seems to be cleaned after the redirect.
Any idea welcome,
Thanks!
[590 byte] By [
javosoa] at [2007-11-27 9:06:58]

# 2
That means
http://servname.com/app1/page1.jsp :
<%
session.setAttribute("para","theValue");
response.sendRedirect("http://servname.com/app2");
%>
http://servname.com/app2/index.jsp :
<%
String value = (String) session.getAttribute("para");
%>
should work?
Thanks.
# 3
Hi,r u using redirect in a jsp itself or in servlet?if u r redirecting in a servlet, u can user request dispatcher.request.setAttribute("param", "value");request.getRequestDispatcher("app2.jsp").forward(request,response);Regards,kaysure
# 5
Ok.
Remember that there are four attribute scopes.
- Page - within one jsp page
- Request - within one request/response cycle
- Session - within one users 'dialogue' of request/response to the server
- Application - available to all users of a web application.
You seem to be wanting to share the session across multiple web applications.
Unfortunately it doesn't work like that :-(
A users session is related to the web application. AFAIK you can't switch web apps and retain the session. In fact you need special setup to allow web applications to access eachothers "application" level attributes.
What are you trying to accomplish by doing this?
Would "Single sign on" help?