Re: Proccessing parameters inside Struts action
In the commons classes at http://kenai.com/projects/commons, there is a class ServletUtils with the following code to extract parameters and place them into a Collection from a servlet request (which can be obtained via ServletActionContext.getRequest()): public static Collection getParameters(ServletRequest servletRequest) { Collection results = new ArrayList(); Enumeration e = servletRequest.getParameterNames(); while(e.hasMoreElements()) { String parameterName = (String)e.nextElement(); results.add(parameterName); } return results; } On Oct 12, 2009, at 12:19 PM, Michael Varlik wrote: Hi, I'm using a Struts2 action to devliver JSON data. This action is calleb by an Ajax HTTP request. Now, I need to send some parameter along with the request. The sending of the parameters works fine but I don't know how to access them from within the struts action. So my question is: what is the proper way to pass POST parameters to a struts action and how do I retrieve them from within the action? Many thanks in advance. Cheers, Michael -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- terry.gard...@sun.com Blog: http://ff1959.wordpress.com http://www.directory-server.org Mobile: 404 925 6385 smime.p7s Description: S/MIME cryptographic signature
Re: Proccessing parameters inside Struts action
Hi Michael, when You have in POST request myParam with myValue then in action simply add public setter setMyParam(String value) it's same as for standard request. Best greetings, Paweł Wielgus. 2009/10/12 Michael Varlik : > Hi, > > I'm using a Struts2 action to devliver JSON data. This action is calleb by an > Ajax HTTP request. Now, I need to send some parameter along with the request. > The sending of the parameters works fine but I don't know how to access them > from within the struts action. > So my question is: what is the proper way to pass POST parameters to a struts > action and how do I retrieve them from within the action? > > Many thanks in advance. > Cheers, > Michael > -- > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Proccessing parameters inside Struts action
Hi, I'm using a Struts2 action to devliver JSON data. This action is calleb by an Ajax HTTP request. Now, I need to send some parameter along with the request. The sending of the parameters works fine but I don't know how to access them from within the struts action. So my question is: what is the proper way to pass POST parameters to a struts action and how do I retrieve them from within the action? Many thanks in advance. Cheers, Michael -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org