摘要:
自定义拦截器:自定义拦截器可以处理 敏感词汇等。AOP的一个体现。实现Interceptor接口,重写intercept方法,invocation.invoke()会循环调用。View Code import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.Interceptor;public class MyInterceptor implements Interceptor { public void destroy() { // TODO Auto-... 阅读全文
posted @ 2012-02-26 16:07
濤叔
阅读(282)
评论(0)
推荐(0)
摘要:
struts.xml<constant name="struts.custom.i18n.resources" value="app"></constant>资源文件的名称为 app_*_*.propertiesapp_en_US.propertiesView Code login.username=username:login.password=password:login.login=loginwelcome.msg=welcome:{0}app_zh_CN.propertiesView Code login.username 阅读全文
posted @ 2012-02-26 13:57
濤叔
阅读(190)
评论(0)
推荐(0)
摘要:
创建配置文件:格式 文件名_语言_国家.properties (文件名后面都是固定的),如:app_en_US.propertiesapp_zh_CN.propertiesJAVA调用文件:View Code public static void main(String[] args) { ResourceBundle res = ResourceBundle.getBundle("app", Locale.CHINA); System.out.println(res.getString("welcome.msg" )); }会自动调用 app_zh_C 阅读全文
posted @ 2012-02-26 12:27
濤叔
阅读(336)
评论(0)
推荐(0)
摘要:
所有异常不在action中处理,全部抛出。然后在struts.xml中进行处理。struts.xmlView Code <action name="*-*" class="com.bjsxt.bbs2009.action.{1}Action" method="{2}"> <result>/admin/{1}-{2}.jsp</result> <result name="input">/admin/{1}-{2}.jsp</result> <excep 阅读全文
posted @ 2012-02-26 11:37
濤叔
阅读(203)
评论(0)
推荐(0)

浙公网安备 33010602011771号