jsp: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">…
1.设置struts的字符编码,能够在struts.xml中添加下面代码: <constant name="struts.i18n.encoding" value="GBK" /> 或者找到struts的默认配置文件,位置在 struts2-core-2.3.16.3.jar 里面 org.apache.struts2 包中的 default.properties 文件.改动下面配置: ### This can be used to set your d…
1.在应用项目中,异常的出现时很正常的.而且项目上线后发生异常也很正常的.那么需要对这些异常有相应的处理机制,以便客户能够看你到更加友好的界面.Struts2中提供了异常处理机制. 2.Struts中异常处理实现 a) 在 action 处理类中抛出的异常 public class UserAction { public String add() throws NullPointerException{ if(1==1) throw new NullPointerException("数据为nu…