PDA

View Full Version : Problem with RTL string in Response



shahab_et
7 Feb 2011, 2:45 AM
Hi,

I'm using this code to submit a form :

DocForm.getForm().submit({
method:'POST',
waitTitle:'Connecting to server...',
waitMsg:'Sending Data...',
url:'/industrialWebClient/seam/resource/myresource',
params: {
storeData: Ext.encode(data),
op:4
},
success:function(form, action) {
Ext.Msg.alert('Success', action.result.msg);
},
failure :function(form, action) {
switch (action.failureType) {
case Ext.form.Action.CLIENT_INVALID:
Ext.Msg.alert('Error','Client Data is invalid');
break;
case Ext.form.Action.CONNECT_FAILURE:
//Ext.Msg.alert('Failure', 'Ajax communication failed');
Ext.Msg.alert('Error', 'Server reported:' + action.response.status + ' ' + action.response.statusText);
break;
case Ext.form.Action.SERVER_INVALID:
Ext.Msg.alert('Error', action.result.msg);
break;
}
}})

and on the server side , this is how I make the response :


catch (AccountingException e)
{
response.getWriter().write("{'success':false, 'msg':\"" + e.getResponseText() + "\"}");
}

and finally my response string is something like this :

{'success':false, 'msg':"???"}


but no response is sent to client after I submit the form,

note: the string is a "Farsi" language string which I get from a resourceBundle in java.

shahab_et
16 Feb 2011, 5:31 AM
for those who may have the same problem:



String rsp = "{success: false,message: '" + e.getResponseText() + ".'}";

response.getOutputStream().write(rsp.getBytes("UTF-8"));
response.getOutputStream().close();