随笔分类 - structs
摘要:Spring 和 struts 整合的三种方式。1,使用Spring 的 ActionSupport 2, 使用Spring 的 DelegatingRequestProcessor 类。3,全权委托。无论用那种方法来整合第一步就是要为struts来装载spring的应用环境。 就是在 struts 中加入一个插件。struts-config.xml中<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"><set-property property="con
阅读全文
posted @ 2008-06-02 06:16
shine_panda
摘要:使用struts 框架中 DispatchAction 的时候 如果不小心将 execute 方法重写了就会发现 DispatchAction不起作用.了.我个人认为这应该算是struts框架的一个小小的bug .我们可以利用java的反射机制自定义 DispatchAction来解决这一问题.代码:struts-config.xml:<action attribute="calculateForm" input="/calculate.jsp" name="calculateForm" path="/calculat
阅读全文
posted @ 2008-04-01 09:29
shine_panda
摘要:struts 中要实现国际化1,要在资源文件配置语言如: ApplicationResources.properties 中 有form.choose=请选择form.language1=英语form.language2=中文ApplicationResources_en_US.properties中有form.choose=please chooseform.language1=Englishform.language2=Chinese2 ,页面上的所有静态文字都要用 <bean:message key=""/> 来进行显示3,设置浏览器 在internate
阅读全文
posted @ 2008-03-31 12:43
shine_panda
摘要:本人在初学struts 的 validator 框架的时候发现 验证根本不起,查看代码没有问题 作用找了好久才发现问题的所在使用validator 框架有几个必须要注意的地方.1, 要配置 validation.xml 文件2,要在 struts-config.xml 中配置<plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-r
阅读全文
posted @ 2008-03-31 10:19
shine_panda
摘要:初学Struts的人一定遇到过中文的乱码问题,目前解决的方法有很多。我这有两种经典的方法和大家分享。1,重写 RequestProcessor 这是最简单的方法。public class MyRequestProcessor extends RequestProcessor {@Overrideprotected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) {try {request.setCharacterEncoding("UTF-8"); //在
阅读全文
posted @ 2008-03-25 11:18
shine_panda

浙公网安备 33010602011771号