You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bhaskar Gopalan <bg...@adaptintel.com> on 2002/03/26 00:49:48 UTC

Communication between JSPs

Hi,
I'm new to struts and have this silly question:

My code does not use struts currently. From JSP1, I call another JSP2 using
the "action" and I also pass parameters. Now, I want to incorporate struts
in my code. So, do I have to replace the reference to jsp2 by action class?
If so, how do i pass parameters from jsp1 to jsp2 thru action1?

Thanks,
Bhaskar

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Communication between JSPs

Posted by Joseph Barefoot <jo...@hereuare.com>.
Oops, forgot to mention something, so I'll reproduce it as it should have
been written:

In jsp1, replace the URL reference to jsp2 with a URL reference to an Action
class's mapped URL (as defined in the actionmapping in struts-config.xml)
instead.  The Action class retrieves the parameter values and sets them as
field values in an ActionForm bean associated with jsp2.  After the Action
sets these field values, it returns an ActionForward referencing jsp2, to
transfer control to it. You can then easily retrieve the values from the
ActionForm in jsp2 using Struts' custom tags.

-----Original Message-----
From: Joseph Barefoot [mailto:josephb@hereuare.com]
Sent: Monday, March 25, 2002 4:06 PM
To: Struts Users Mailing List
Subject: RE: Communication between JSPs


Hi Bhashkar,

You don't "have to" replace the reference if you don't want, but if you want
everything to run through the Struts controller, you should.  There are a
couple of ways pass URL parameters from jsp1 to jsp2 via Struts, but here's
how I do it:


In jsp1, replace the URL reference to jsp2 with a URL reference to an Action
class's mapped URL (as defined in the actionmapping in struts-config.xml)
instead.  The Action class retrieves the parameter values and sets them as
field values in an ActionForm bean associated with jsp2.  You can then
easily retrieve them from this ActionForm in jsp2 using Struts' custom tags.




-----Original Message-----
From: Bhaskar Gopalan [mailto:bgopalan@adaptintel.com]
Sent: Monday, March 25, 2002 3:50 PM
To: struts-user@jakarta.apache.org
Subject: Communication between JSPs


Hi,
I'm new to struts and have this silly question:

My code does not use struts currently. From JSP1, I call another JSP2 using
the "action" and I also pass parameters. Now, I want to incorporate struts
in my code. So, do I have to replace the reference to jsp2 by action class?
If so, how do i pass parameters from jsp1 to jsp2 thru action1?

Thanks,
Bhaskar

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Communication between JSPs

Posted by Joseph Barefoot <jo...@hereuare.com>.
Hi Bhashkar,

You don't "have to" replace the reference if you don't want, but if you want
everything to run through the Struts controller, you should.  There are a
couple of ways pass URL parameters from jsp1 to jsp2 via Struts, but here's
how I do it:


In jsp1, replace the URL reference to jsp2 with a URL reference to an Action
class's mapped URL (as defined in the actionmapping in struts-config.xml)
instead.  The Action class retrieves the parameter values and sets them as
field values in an ActionForm bean associated with jsp2.  You can then
easily retrieve them from this ActionForm in jsp2 using Struts' custom tags.




-----Original Message-----
From: Bhaskar Gopalan [mailto:bgopalan@adaptintel.com]
Sent: Monday, March 25, 2002 3:50 PM
To: struts-user@jakarta.apache.org
Subject: Communication between JSPs


Hi,
I'm new to struts and have this silly question:

My code does not use struts currently. From JSP1, I call another JSP2 using
the "action" and I also pass parameters. Now, I want to incorporate struts
in my code. So, do I have to replace the reference to jsp2 by action class?
If so, how do i pass parameters from jsp1 to jsp2 thru action1?

Thanks,
Bhaskar

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>