Java需要我們學習相當多的'知識,下面YJBYS小編為大家整理了關於關於struts的解決方法文章,希望對你有所幫助。
try {
haracterEncoding(“GBK”);
tln(“字元成功轉向”);
} catch (UnsupportedEncodingException e) {
tStackTrace();
tln(“字元轉向失敗!”);
}
問題依舊,後來才明白,應該這樣做:
1,寫一個類,繼承RequestProcessor
import pportedEncodingException;
import ServletRequest;
import ServletResponse;
import estProcessor;
public class EnRequestProcessor extends RequestProcessor {
@Override
protected boolean processPreprocess(HttpServletRequest request,
HttpServletResponse response) {
// TODO Auto-generated method stub
try {
haracterEncoding(“GBK”);
tln(“字元成功轉向”);
} catch (UnsupportedEncodingException e) {
tStackTrace();
tln(“字元轉向失敗!”);
}
return true;
}
}
然後,在裡寫入:
在《/action-mappings》後面加,不要加在裡面哦~~
《controller processorClass=“questProcessor”》《/controller