A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
JSP
Author
communication Between two servlets
abinash das
Ranch Hand
Joined: Apr 26, 2008
Posts: 52
posted
Mar 17, 2009 03:44:53
0
How can i pass some value from a
servlet
to a
JSP
if the request dispatch mode is
response.sendRedirect.
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9191
2
I like...
posted
Mar 17, 2009 04:27:39
0
You can add parameters to the url that you give in the sendRedirect method like this
response.sendRedirect("/myPage.jsp?param="+myParam);
Or you can set the value in a session attribute and retrieve it in the other servlet but for that you'll have to encode the redirect url with the session id
response.sendRedirect(reponse.encodeRedirectURL("/myPage.jsp"));
SCJP 6 | SCWCD 5 |
Javaranch SCJP FAQ
|
SCWCD Links
abinash das
Ranch Hand
Joined: Apr 26, 2008
Posts: 52
posted
Mar 17, 2009 05:20:13
0
In the given techinque
i,e response.sendRedirect(reponse.encodeRedirectURL("/myPage.jsp"));
how can i pass values to myPage.jsp.
maens how to define and set values and how to get these values at myPage.jsp
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
Mar 17, 2009 06:56:18
0
When redirecting, pass it as request parameters (visible in URL).
When forwarding, pass it as request attributes (hidden from URL).
Code depot of a Java EE / JSF developer
|
JSF / Eclipse / Tomcat kickoff tutorial
|
DAO kickoff tutorial
|
I ♥ Unicode
I agree. Here's the link:
http://aspose.com/file-tools
subject: communication Between two servlets
Similar Threads
Export in Excel
Capturing Form Data
Un-downloadable Applets
WA #1.....word association
Downloading HTML page
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter