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]
# 1
I use response.sendRedirect all the time, and I never had any problems getting the values from the session..?
Nidhuggura at 2007-7-12 21:43:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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.

javosoa at 2007-7-12 21:43:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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
JavaSurea at 2007-7-12 21:43:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi,all within jsps. And I have to change in the same server from one application to another.As you can see in my example:from http://servname.com/app1/page1.jspto http://servname.com/app2/index.jsp
javosoa at 2007-7-12 21:43:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 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?

evnafetsa at 2007-7-12 21:43:06 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...