开发者

jboss valve encoding problem while url rewriting

I have an app., coded with ejb3, jsf and maven, which runs on jboss 4.2.2GA

The problem I have been facing for 2 days is I cannot convert non-english characters that are added to url on runtime. For instance, there is a search textbox and a button. When a user enters a word including non-english characters, and pushes the button, it is added to the url with bad characters like %56 or &347 etc..

Is there any way to achieve what I am trying to do here? BTW, is there also any way to get over this problem on the jboss side configuration rather than application side (filters or context.xml etc..)?

Any help would be appreciated Thanks a lot, Baris

-- EDIT: I have solved this issue by using URLEncoder. When I passed the variable to the action method, I use URLEncoder in order to encode it to the right ch开发者_StackOverflowarset.

Example: Take parameter from the URL: String someString = ServletActionContext.getRequest().getParameter("someStringFromURL"); Encode the string; String encoded = URLEncoder.encode(someString, "ISO-8859-9");


Find the appropriate connector element in your tomcat server.xml (deploy/jboss-web.deployer/server.xml for recent versions) and add the attribute URIEncoding with a value of UTF-8.


I have solved this issue by using URLEncoder. When I passed the variable to the action method, I use URLEncoder in order to encode it to the right charset.

Example: Take parameter from the URL:

String someString = ServletActionContext.getRequest().getParameter("someStringFromURL"); 

Encode the string;

String encoded = URLEncoder.encode(someString, "ISO-8859-9");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜