Hello Maurizio, thanks. Headers sended as "GET" are:
Hostlocalhost:8080User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0Acceptapplication/json, text/javascript, */*; q=0.01Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encodinggzip, deflateAccept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7Connectionkeep-alive Content-Typeapplication/json; charset=utf-8X-Requested-WithXMLHttpRequest Refererhttp://localhost:8080/Aplicacion/prueba.jspCookie JSESSIONID=A650C235C78B2657B14534363D938F80 And parameters are sended as: customDatasomeinfojgGridData[{"id":"1","direccion":"Calle del Pardo 3","nombre":"Paco1"},{"id":"2","direccion":"Calle del Pardo 2","nombre":"Paco2"},{"id":"3","direccion":"Calle del Pardo 1","nombre":"Paco3"}] So, it seems be ok. Not as POST: Headers sended as "POST" are: Hostlocalhost:8080User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0Acceptapplication/json, text/javascript, */*; q=0.01Accept-Languagees-es,es;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encodinggzip, deflateAccept-CharsetISO-8859-1,utf-8;q=0.7,*;q=0.7Connectionkeep-alive Content-Typeapplication/json; charset=utf-8X-Requested-WithXMLHttpRequest Refererhttp://localhost:8080/AplicacionDiet99/prueba.jspContent-Length334 CookieJSESSIONID=A650C235C78B2657B14534363D938F80 And parameters!!!: jgGridData=%5B%7B%22id%22%3A%221%22%2C%22direccion%22%3A%22Calle+del+Pardo+3%22%2C%22nombre%22%3A%22Paco1 %22%7D%2C%7B%22id%22%3A%222%22%2C%22direccion%22%3A%22Calle+del+Pardo+2%22%2C%22nombre%22%3A%22Paco2 %22%7D%2C%7B%22id%22%3A%223%22%2C%22direccion%22%3A%22Calle+del+Pardo+1%22%2C%22nombre%22%3A%22Paco3 %22%7D%5D&customData=someinfo So, you might be right. How can I send as GET format by POST method? 2011/12/16 Maurizio Cucchiara <maurizio.cucchi...@gmail.com> > I'm not sure, but if I recall correctly that could be an encoding issue. > In such case firebug plugin or chrome console might be very usefull. > > Sent from my mobile device, so please excuse typos and brevity. > > Maurizio Cucchiara > > Il giorno 16/dic/2011 12.23, "José Manuel Sendín Cruz" < > jmanuel.sendin.c...@gmail.com> ha scritto: > > > [I tried to simplifie the code to better understand the questions]When I > > tried to send data from a web side client to an ActionClass in Struts 2 > > like: > > > > CLIENT SIDE: > > ----------------------------------------- > > jQuery("#bedata").click(function(){ //Function for button "bedata" > > > > var postData = "SOME DATA TO SEND" > > > > //Sendin data: > > $.ajax({ > > type: "POST", //Method to send the data. I would need "post" > method > > as better option. > > url: "GuardaFila.action", //Action called to data treatament > > data : { > > jgGridData: postData, //PARAMETER jgGrdData with variable > > "postData" value > > customData: "someinfo" //Just another parameter called > > "customData" with more data, > > }, > > > > > > /** START: handlers for request. Not important for this trouble **/ > > dataType:"json", > > contentType: "application/json; charset=utf-8", > > success: function(response, textStatus, xhr) { > > alert("success"); > > }, > > error: function(xhr, textStatus, errorThrown) { > > alert("error"); > > } > > /** END: handlers for the request. **/ > > }); > > }); > > > > > > ---------- > > > > > > I wanted to autofill "jgGridData" and "customData" attributes from > > ActionClass that is called when "CargaTabla.action" is invoked. But if > type > > is POST, it doesnt work. > > Just changing POST type in ajax type of sending, turning on "GET", it > works > > fine. The call to CargaTabla.action ActionClass setters methods for the > > jgGridData and customData has done properly. > > > > > > > > SERVER SIDE: > > My struts.xml piece of significant code is: > > > > <action name="GuardaFila" method="guardarUsuario" > > class="org.json.JSONRespuestaTabla"> > > <result name="success" type="json" /> > > </action> > > > > So, GuardaFila action in its method "guardarUsuario" is properly called > in > > debuggin. A simplified version of ActionClass > (org.json.JSONRespuestaTabla) > > is: > > > > public class JSONRespuestaTabla extends ActionSupport{ > > > > String jgGridData = "Old data to be refilled from client"; > > String customData = "Old data to be refilled from client"; > > > > @Override > > public String execute() { > > //Some stuff > > return SUCCESS; > > } > > > > //Getters and Setter of attributes. > > > > public void setJgGridData(String resultado){ > > System.out.append(resultado); > > } > > public String getJgGridData(){ > > return this.jgGridData > > } > > public String getCustomData() { > > return customData; > > } > > public void setCustomData(String customData) { > > this.customData = customData; > > } > > > > //And the method called and defined in struts.xml (properly called) > > public void guardarUsuario(){ > > //Some stuff. > > return; > > } > > > > Well, so. If Javascript send the parameters in GET mode, SETTERS are > > working nice, and I can get "SOME DATA TO SEND" on my ActionClass > > JSONRespuestaTabla setted automatically, ready to work with. But if > > JavaScript sends this data in POST mode, Struts doesnt call the setters, > > and I am not able to recieve the data into the class that handle the > > action. > > > > How it comes that? I cant understand why it happens. > > > > I am using jquery, json and tiles plugin for struts2. > > > > Thank you for your help. > > >