Java EE Development of various types of resources download list, the history of the most complete IT resources, personal collection summary.
The <controller> tags are configured primarily to allow struts to identify the controller components that are customized by the developer. Enable them to process requests using different requestprocessor classes.
<controller processorclass= "Edu.encoding.RequestChinese" ></controller>
Processorclass: Specifies the full classpath name of the requested Java class. Default is Org.apache.struts.action.RequestProcessor.
user-defined Requestprocessor class
(1) A class written by the user must inherit the Requestprocessor class and override its process () method.
(2) The function of this class and actionservlet is to process the controller component of the request, which is called by the Actionservlet to process the request. A request that is processed before entering actionform and action.
public class Requestchinese extends Requestprocessor {
@Override
public void process (HttpServletRequest request, httpservletresponse response)
Throws IOException, Servletexception {
Request.setcharacterencoding ("Utf-8");
The next sentence is to be executed, which means to give the request to the controller below.
Super.process (request, response);
}
}
Mappings in Struts-config.xml:
<controller processorclass= "Edu.encoding.RequestChinese" ></controller>
Or:
<controller>
<set-property property= "Processorclass" value= "Org.springframework.web.struts.DelegatingRequestProcessor"/ >
</controller>