Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to automatically pass parameters between jsp

5 views
Skip to first unread message

mmala...@gmail.com

unread,
Nov 14, 2005, 4:53:36 AM11/14/05
to
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

unread,
Nov 14, 2005, 7:16:13 AM11/14/05
to
mmala...@gmail.com wrote:
> 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?

mmala...@gmail.com

unread,
Nov 14, 2005, 10:11:19 AM11/14/05
to

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

unread,
Nov 15, 2005, 12:41:41 PM11/15/05
to
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.

mmala...@gmail.com

unread,
Nov 16, 2005, 3:00:19 AM11/16/05
to
Thx, in fact I ended up using a session-scoped bean to exchange those
information between pages.
MM

0 new messages