You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caroline Jen <ji...@yahoo.com> on 2004/03/24 07:07:54 UTC
Retrieve a Variable From the DynaActionForm
In my Struts application, postForm is of the
DynaActionForm type:
DynaActionForm postForm = ( DynaActionForm )form;
Later on, I want to save one of the fields "receiver",
which is a String, in the request context. Which is
the following is the correct syntax?
request.setAttribute( "Receiver", postForm.get(
"receiver") );
Or
request.setAttribute( "Receiver", ( String
)postForm.get( "receiver") );
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Retrieve a Variable From the DynaActionForm
Posted by Pedro Salgado <sa...@04web.com>.
On 24/03/2004 06:07, "Caroline Jen" <ji...@yahoo.com> wrote:
> In my Struts application, postForm is of the
> DynaActionForm type:
> DynaActionForm postForm = ( DynaActionForm )form;
>
> Later on, I want to save one of the fields "receiver",
> which is a String, in the request context. Which is
> the following is the correct syntax?
>
> request.setAttribute( "Receiver", postForm.get(
> "receiver") );
>
> Or
>
> request.setAttribute( "Receiver", ( String
> )postForm.get( "receiver") );
I think they are equivalent.
Later, if you use request.getAttribute("Receiver"); (getAttribute always
returns an object) you would still need to cast to String, if you wanted to
do something with the object.
If you just want to print you just need to use <c:out
value='${request.Receiver}'/> in any of the cases described above.
Pedro Salgado
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance Tax Center - File online. File on time.
> http://taxes.yahoo.com/filing.html
>
> ---------------------------------------------------------------------
> 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