You can use request.getParameter()/getParameterValues() inside an Action to retrieve form values without using an ActionForm. However, without an ActionForm, you won't be able to use the Struts <html:form> and related tags and form validation.
--- None None <[EMAIL PROTECTED]> wrote: > Is it the case that every Action MUST be associated with an ActionForm? > Next week I have to start converting an app to Struts, and one of the > assumptions I've been making is that I can just NOT associate any > ActionForm > with the Actions. As you say it's not a big deal, I can just do the empty > form like you said, but I'd like to know if that's the only way... > > > >From: Avinash Gangadharan <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> > >Subject: RE: getting non-struts form elements > >Date: Fri, 14 May 2004 15:08:10 -0700 > > > >Matt, > >In your action class, you have the request and the response object which > >will get you all your form elements > > > >public ActionForward execute(ActionMapping mapping, ActionForm form, > > HttpServletRequest request, HttpServletResponse response) > > throws java.lang.Exception { > > String xxx = ( String ) request.getParameter("xxx"); > > // now do anything with xxx > >} > > > >As far as configuring your action in the struts-config, you can associate > >an > >empty form to your action : > ><form-beans> > > <form-bean > > name="emptyForm" > > type="org.apache.struts.action.DynaActionForm"/> > ></form-beans> > > > >and then add 'name="emptyForm"' in your action mapping: > > > > <action path="/yourAction" > > type="your.action.type" > > name="emptyForm" > > scope="request" > > > > > <forward > > name="..." > > path="..."/> > > </action> > > > > > >I hope this is what you are looking for. > > > >Avinash > > > > > > > > > >-----Original Message----- > >From: Matt Bathje [mailto:[EMAIL PROTECTED] > >Sent: Friday, May 14, 2004 2:45 PM > >To: Struts Users Mailing List > >Subject: getting non-struts form elements > > > > > >Hi all. > > > >I have a form that is not a struts form bean (no actionform, no dynaform, > >nothing...) > > > >Is it possible to have this submit to a struts action, and read the form > >elements somehow? I need to be able to read simple (String) elements as > >well > >as multi-part (formfile) elements from the form. > > > >Any way to do it in struts, or do I just need to give up and make > something > >non-struts to do it? > > > > > > > >Thanks, > >Matt Bathje > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > _________________________________________________________________ > Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? SBC Yahoo! - Internet access at a great low price. http://promo.yahoo.com/sbc/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]