Struts 1.x with multipart form and UTF-8

In order to bypass the problem with UTF-8 character set in a multi-part form,
you have to create a new class ScyllaRequestProcessor that overwrites
the default controller RequestProcessor.

Step 1: Create a new class:

public class ScyllaRequestProcessor extends RequestProcessor {

public void process(HttpServletRequest request, HttpServletResponse
response) throws IOException,
ServletException {
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
super.process(request, response);
}
}

Step 2: Update the processorClass in struts-config.xml
<controller processorClass="tuc.isc.eprot.services.ScyllaRequestProcessor" />

No comments:

Post a Comment