Struts problem set

xiaoxiao2021-03-06  55

When Struts Form submits a normal control, the values ​​obtained in the action are garbled. To use Filter to process EncodingFilter com.jbbis.scms in web.xml file .filter.encodingfilter Encoding gbk < filter-mapping> EncodingFilter / * public class EncodingFilter implements filter {private String encoding = "GBK";

EncodingFilter categories: / * (non-Javadoc) * @see javax.servlet.Filter # init (javax.servlet.FilterConfig) * / public void init (FilterConfig fc) throws ServletException {String s = fc.getInitParameter ( "Encoding") ; If (s! = Null) {this.Encoding = s;}}

/ * (Non-Javadoc) * @see javax.servlet.Filter # doFilter (javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) * / public void doFilter (ServletRequest request, ServletResponse response, FilterChain fc ) throws IOException, ServletException {request.setCharacterEncoding (encoding); fc.doFilter (request, response);} / * (non-Javadoc) * @see javax.servlet.Filter # destroy () * / public void destroy () { } Please refresh the project when CVS in Eclipse

转载请注明原文地址:https://www.9cbs.com/read-113348.html

New Post(0)