I have a jsp file where i am collection form values and send it to struts 2 action class through jquery Ajax.
My Ajax function looks like
var DataValues = $("#Form1").serialize();
alert(DataValues);
alert(decodeURI(DataValues));
$.ajax({url: urlPass,
dataType:datatypepass,
method:methodpass,
data:DataValues,
success: function(data,stat,Xhr){calbackPass(data,stat,Xhr);},
error:function(xhr, status, error){alert("Error : "+xhr.responseText+" status : "+xhr.status);}
});
when i decodeurl and alert it the text i correctly encoded and decoded.
when i send it to struts2 through ajax it makes problem.
i have checked the values in Interceptor it shows the value ???????
Interceptor
public class LoginInterceptor extends AbstractInterceptor implements StrutsStatics
{
@Override
public String intercept(ActionInvocation arg0) throws Exception
{
HttpServletRequest rs=ServletActionContext.getRequest();
System.out.println(rs.getCharacterEncoding());
Map session=ActionContext.getContext().getSession();
Map<String, Object> parameters=ActionContext.getContext().getParameters();
for(Map.Entry<String, Object> ll:parameters.entrySet())
{
String a[]=(String[])ll.getValue();
for(String b:a)
{
System.out.println(ll.getKey()+" : "+b);
}
}}}}
in my jsp file i have set content type as UTF-8 and in ajax also i have checked with content type but its not working.In tomcat server.xml also i have set content-type as UTF-8
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>
any other setting has to be done for this UTF-8
Thanks in advance.