struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Hill" <andrew.david.h...@gridnode.com>
Subject RE: Passing Parameters Between Actions
Date Wed, 16 Jul 2003 03:51:34 GMT
<snip>
Is there any reason you are forwarding from JSP?
</snip>

JSP where got?
He stated quite clearly he is forwarding from one action to another using
(returning I presume) an ActionForward.

<snip>
<forward name="action2" path="/Action2.do"/>
</snip>

I was going to suggest that you specify redirect="false" in the forward, but
looking at the javadoc it seems that that is the default already! Hmm.. Try
it anyway and see if it works as it sounds very much like your doing a
client side redirect :-)

If it really is doing a server side redirect you should still be able to get
at that parameter - the only situation I can think of where you would get
these symtoms is if its a multipart request and the first action has an
actionform associated with it and the second does not. (If if that parameter
is due to some other request wrapper implementation). That doesnt explain
the attributes not working though. It really does sound like your doing a
client side redirect.

Hmmm... just checked the source and its definately default to
redirect=false. Ok, I give in...

btw: its considered bad practice to chain actions in this manner. Search the
archive to find out why...

-----Original Message-----
From: Jung Yang [mailto:jyang@innovativeit.com]
Sent: Tuesday, 15 July 2003 22:31
To: struts-user@jakarta.apache.org
Subject: Re: Passing Parameters Between Actions


Is there any reason you are forwarding from JSP?  Try using Dispatcher
in Action1 class like

request.getRequestDispatcher("/Action2.do").forward(request, response);

- jung

Hunter Hillegas wrote:
> I am trying to pass a parameter between two actions and running into
> trouble.
>
> I call action 1 like this: /Action1.do?rec_num=1
>
> Action1 does some processing and when complete it forwards via an
> ActionForward to Action2 as such:
>
> <forward name="action2" path="/Action2.do"/>
>
> Action2 has no way to retrieve the parameter originally passed in to the
> first action, "rec_num". When I try to grab it using
request.getParameter()
> I get a NPE.
>
> I also tried setting it as a request attribute and that didn't work.
Session
> might work but I am trying not use sessions.
>
> Any ideas on what I can do?
>
> Thanks,
> Hunter



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message