Showing posts with label STRUTS. Show all posts
Showing posts with label STRUTS. Show all posts

Struts 1.x: How to output HTML string from an ActionForm paramete

We have the following ActionForm

public class DocListForm extends ActionForm {
private String multiPagesHtml = "your HTML string .....";
}

Then, in the jsp file we can use the following:
<bean:write name="docListForm" property="multiPagesHtml" filter="false"/>

with FILTER = FALSE

in order to display the HTML output of the multiPagesHTML

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" />