You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gunnar Boström <Gu...@telia.se> on 2001/04/19 08:08:26 UTC

input and output form in Action

Newbie question.
Is the form parameter in the perform method meant to be used both for input
values and output values (from the Action)?

If not how do I specify the output form?

:-)



Re: input and output form in Action

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 19 Apr 2001, [iso-8859-1] Gunnar Bostr�m wrote:

> Newbie question.
> Is the form parameter in the perform method meant to be used both for input
> values and output values (from the Action)?
> 

The form parameter's primary purpose is input, but you can use it for
output as well under the following circumstances:
* You are forwarding (and not redirecting) to the next page
  if the form bean is in request scope.
* The page you forward to expects the bean under the same key
  (and in the same scope) that you have declared it in struts-config.xml.
* The output you want to accomplish can be done by simply modifying
  properties of the form bean.

> If not how do I specify the output form?
> 

The other way to "output" information from an Action is to simply store an
attribute under some key that is used in the destination page -- typically
either by calling request.setAttribute() or session.setAttribute().


> :-)
> 
> 
> 

Craig