struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesse Alexander (KAID 11)" <alexander.je...@credit-suisse.com>
Subject RE: Accessing ActionForm from Servlet (was: Pajes + Struts)
Date Wed, 04 Feb 2004 17:22:22 GMT
Well it is also allowed to produce the output in the Action. Maybe it would be easier to call
Pajes from the Action, stream the result into the response.out and return a "null"-ActionForward.

hth
Alexander

-----Original Message-----
From: Hubert Rabago [mailto:jakartauser@yahoo.com]
Sent: Mittwoch, 4. Februar 2004 18:13
To: Struts Users Mailing List
Subject: RE: Accessing ActionForm from Servlet (was: Pajes + Struts)


Hi Fred(d)y,

> (3) Despite 1 and 2, there must be a method to obtain the ActionForm(s)
> associated to an Action (during an specific request / post). Right?

I think this question has been answered twice in this very thread, once by
me, and again (and with code) by Andrew Hill.  

>From Andrew's response, with some editing:
String scope = mapping.getScope(); 
String attribute = mapping.getAttribute(); 
ActionForm yourForm = null;
if ("request".equals(scope)) {
    yourForm = (ActionForm) request.getAttribute(attribute);
} else {
    yourForm = (ActionForm) request.getSession().getAttribute(attribute);
}

If you don't want to pass around the mapping, then you'll need to know the
attribute under which the form is kept, and that defaults to the form's name
as declared in the <form-bean> declaration.  Also, you've indicated you want
the form in request scope, so you can go straight to checking the request
attributes.

--- "Villalba Arias, Fredy [BILBOMATICA]" <fvillalba@mailext.com> wrote:
> Hi </thorsten>
> 
> I don't know for sure. That's why I asked if I was right... :)
> 
> Anyway:
> 
> (1) How do you associate 2 ActionForms to the same Action (and have
> them automatically associated and populated by Struts)?
> 
> (2) Assuming 1 is possible (I'd really appreciate if you could explain
> me how to acomplish that), what sense does it make to have 2 ActionForms
> variables if only one form can be submitted at a time anyways? (maybe
> I'm missing something else)
> 
> (3) Despite 1 and 2, there must be a method to obtain the ActionForm(s)
> associated to an Action (during an specific request / post). Right?
> 
> Regards,
> Freddy.
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

---------------------------------------------------------------------
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