Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > how to automatically pass parameters between jsp

Reply
Thread Tools

how to automatically pass parameters between jsp

 
 
mmalaidini@gmail.com
Guest
Posts: n/a
 
      11-14-2005
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

 
Reply With Quote
 
 
 
 
Tjerk Wolterink
Guest
Posts: n/a
 
      11-14-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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?
 
Reply With Quote
 
 
 
 
mmalaidini@gmail.com
Guest
Posts: n/a
 
      11-14-2005
Tjerk Wolterink wrote:
> (E-Mail Removed) 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?


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

 
Reply With Quote
 
isamura
Guest
Posts: n/a
 
      11-14-2005
<(E-Mail Removed)> 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?
:
: Or in one.jsp should I modify a bean state at session level, using it
: in two.jsp?
:
Perhaps you could write a method to rewrite the URL, say rewriteUrl(...) and use it like this:

HREF="<%= rewriteUrl("two.jsp", "aVar", "newValue") %>"

..K


 
Reply With Quote
 
mmalaidini@gmail.com
Guest
Posts: n/a
 
      11-15-2005
Yes, but it does mean indeed that there is no automatism.

Thx anyway

 
Reply With Quote
 
isamura
Guest
Posts: n/a
 
      11-15-2005
<(E-Mail Removed)> wrote ...
: Yes, but it does mean indeed that there is no automatism.
:
: Thx anyway
:
I am sure you realize any "automatism" must be handled by some sort of "magic" program/routine. In
your case you can either write the magic yourself or pay someone (like me to do it for you.

Cheers!

..K


 
Reply With Quote
 
PrinceJigar
Guest
Posts: n/a
 
      11-15-2005
You can either pass it to two.jsp using parameters.

<a href="two.jsp?param1=something&param2=something">C lick 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.

 
Reply With Quote
 
mmalaidini@gmail.com
Guest
Posts: n/a
 
      11-16-2005
Thx, in fact I ended up using a session-scoped bean to exchange those
information between pages.
MM

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Pass session parameters from one jsp to another jsp sridhar kumar ch Java 1 06-28-2006 05:28 PM
How to Pass session parameters from one jsp to another jsp sridhar kumar ch Java 0 06-28-2006 11:16 AM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Can we pass parameters to login.jsp in Tomcat Form-Based authentication Bharath Java 3 05-10-2005 05:48 PM
JSP: pass data to request but not via request parameters? Kai Grossjohann Java 2 12-08-2003 09:48 PM



Advertisments