There are 2 problems with this - First (and biggest) it doesn't seem to work for me. I setup a test page, and am attempting to print out the form element names using request.getParameterNames(). This is the code I have:
System.out.println("before"); for(Enumeration e = request.getParameterNames(); e.hasMoreElements(); ) { String curr = (String) e.nextElement(); System.out.println("curr: " + curr); } System.out.println("after"); And the only output I get is: before after None of the fields in my form are being displayed. Any idea what I'm doing wrong? Perhaps does the form have to GET instead of POST? (In which case that won't work, because it would involve changing the form... The second problem is - even if I could get this to work, how do I read in FILE parameters - that was one of the specifications of my original problem - I had to be able to read both string and file form field types. Thanks, Matt ----- Original Message ----- From: "Avinash Gangadharan" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Friday, May 14, 2004 5:08 PM Subject: RE: getting non-struts form elements > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]