PDA

View Full Version : Java


MGangrade
Mar 28, 2014, 10:53 AM
I have a jsp page which takes up first name and last name in chinese language. I am using the struts framework.
I need to pass the first name and last name from the JSP to servlet in terms of unicode characters.
I am doing the following changes:
JSP Changes:I have a jsp page which takes up first name and last name in chinese language. I am using the struts framework.
I need to pass the first name and last name from the JSP to servlet in terms of unicode characters.
I am doing the following changes:
JSP Changes:
1) <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
2) meta content="content-type" content="text/html; charset=utf-8" in the header,

The filter which is called before the action servlet, I have used the following code:
request.setCharacterEncoding("UTF-8");
response.setContentType("UTF-8");

This did not work, the unicode characters which are passed are incorrect, or something not readable.

Considering the MVC framework already creates the request object by the time it reaches the filter,
I modified the JSP to include the following lines of code
<%@ taglib uri="Oracle Technology Network for Java Developers | Oracle Technology Network | Oracle (http://java.sun.com/jsp/jstl/fmt)" prefix="fmt" %>
< fmt:requestEncoding value=" %>
< fmt:requestEncoding value=" />
< fmt:setLocale value="zh_CN"/>

None of the above changes have worked. Please help me to get the correct unicode characters in the action class.
IS there any modification I need to make in the config files.

1) <%@ page pageEncoding=" />
< fmt:setLocale value=" contentType="/>

None of the above changes have worked. Please help me to get the correct unicode characters in the action class.
IS there any modification i need to make in the config files.

1) <%@ page pageEncoding=" %>
2) meta content=" contentType=" content=" %>
2) meta content=" in the header,

The filter which is called before the action servlet, I have used the following code:
request.setCharacterEncoding(" content=");
response.setContentType(" in the header,

The filter which is called before the action servlet, I have used the following code:
request.setCharacterEncoding(");

This did not work, the unicode characters which are passed are incorrect, or something not readable.

Considering the MVC framework already creates the request object by the time it reaches the filter,
I modified the JSP to include the following lines of code
<%@ taglib uri="Oracle Technology Network for Java Developers | Oracle Technology Network | Oracle (http://java.sun.com/jsp/jstl/fmt)");
response.setContentType("fmt" %>
< fmt:requestEncoding value=");

This did not work, the unicode characters which are passed are incorrect, or something not readable.

Considering the MVC framework already creates the request object by the time it reaches the filter,
I modified the JSP to include the following lines of code
<%@ taglib uri=" />
< fmt:setLocale value="zh_CN"/>

None of the above changes have worked. Please help me to get the correct unicode characters in the action class.
IS there any modification I need to make in the config files.