Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / November 2005

Tip: Looking for answers? Try searching our database.

how to automatically pass parameters between jsp

Thread view: 
mmalaidini@gmail.com - 14 Nov 2005 09:53 GMT
I have one.jsp dealing with some parameters.

I'd like to modify maybe one of them, and pass the request to another
jsp (ie: two.jsp) upon user clicking on a link.

Is there any automatism to do that?

Or in one.jsp should I modify a bean state at session level, using it
in two.jsp?
TIA
MMan
Tjerk Wolterink - 14 Nov 2005 12:16 GMT
> I have one.jsp dealing with some parameters.
>
> I'd like to modify maybe one of them, and pass the request to another
> jsp (ie: two.jsp) upon user clicking on a link.
>
> Is there any automatism to do that?

I think you can use the following method:

HttpSerlvetRequest req;
req.getRequestDispatcher().forward("yourjsp.jsp");

or

req.getRequestDispatcher().include("yourjsp.jsp");

Doesnt that work?
mmalaidini@gmail.com - 14 Nov 2005 15:11 GMT
> > I have one.jsp dealing with some parameters.
> >
[quoted text clipped - 13 lines]
>
> Doesnt that work?

Yes, but isn't it just like jsp:forward? I don't want to transfer
current request to another jsp; I'd like to serve my request and
prepare a link (ie: an href) that will receive a request just like the
one I served, maybe with some modifications.

Is that more clearly defined?
Thanks
PrinceJigar - 15 Nov 2005 17:41 GMT
You can either pass  it to two.jsp using parameters.

<a href="two.jsp?param1=something&param2=something">Click here to go to
two.jsp </a>

But if you have a lot of parameter values that u need to pass then you
can do two things. Either create an object to hold all of the values,
dump them on the user session ( load on the web container) and then
retreive that object in two.jsp and take out the various parameters.

or

Create a fake form and submit them upon clicking the link. Then use
request.getParameter("param1) and so on in two.jsp and get the values.
mmalaidini@gmail.com - 16 Nov 2005 08:00 GMT
Thx, in fact I ended up using a session-scoped bean to exchange those
information between pages.
MM


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.