随笔分类 -  Struts2

摘要:SettingsThe following settings can be customized. See thedeveloper guide.SettingDescriptionDefaultPossible Valuesstruts.objectFactory.spring.autoWireThe autowire strategynamename,type,auto, orconstructorstruts.objectFactory.spring.autoWire.alwaysRespectWhether the autowire strategy should always be 阅读全文
posted @ 2013-12-24 16:41 剑握在手 阅读(477) 评论(0) 推荐(0) 编辑
摘要:/input.jsp /addOK.jsp ... 阅读全文
posted @ 2013-12-13 16:07 剑握在手 阅读(225) 评论(0) 推荐(0) 编辑
摘要:在struts中尽量避免自定义拦截器,因为大部分需要自己定义拦截器的时候,设计思路就不对了。大部分拦截器框架都有给你定义好了。而且如果在struts中定义拦截器相当于和这个框架绑定了,假如以后要扩展或者换框架,就可能要重新在新框架中写个拦截器。总之尽量不要自定义struts的拦截器。再次引用一句谚语:Don't Reinvent the Wheel。拦截器的使用实践的是面向切面编程思想。拦截器的使用格式: /test.jsp 自定义拦截器写法:import com.opensymphony.xwork2.ActionInvocation;import com.opensymp... 阅读全文
posted @ 2013-12-13 15:02 剑握在手 阅读(317) 评论(0) 推荐(0) 编辑
摘要:例子: /r1.jsp /r2.jsp r1 r2 访问其他namespace: login dashboard /secure dashboard.jspglobal-results可以让同一个namespace和继承该namespace的namespace共享其result的name,和extends(继承)一起,常用来定义大家都用的results。 ... 阅读全文
posted @ 2013-12-11 16:35 剑握在手 阅读(369) 评论(0) 推荐(0) 编辑
摘要:出发jsp: Insert title here 取得Map类型request,session,application,真实类型 HttpServletRequest, HttpSession, ServletContext的引用: 前三者:依赖于容器 前三者:IOC (只用这种) 后三者:依赖于容器 后三者:IOC 用户名: 密码: struts配置文件: /... 阅读全文
posted @ 2013-12-11 16:04 剑握在手 阅读(291) 评论(0) 推荐(0) 编辑
摘要:一个jsp "/> Insert title here 使用addFieldError方法和s:fieldError标签简单处理数据校验 添加用户 Actionimport com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport { private String name; public String add() { if(name == null || !name.equals(... 阅读全文
posted @ 2013-12-11 14:40 剑握在手 阅读(239) 评论(0) 推荐(0) 编辑
摘要:如果为action配置了类,那么默认就会执行Action类的excute方法,Action类的写法三种:①public class Action1 { public String execute(){ return "abc";//根据返回结果,去xml文件中找name与之匹配的result } }②import com.opensymphony.xwork2.Action;//ActionSupport类实现了该接口public class Action2 implements Action { @Override public String execute() th.. 阅读全文
posted @ 2013-12-11 14:17 剑握在手 阅读(1074) 评论(0) 推荐(0) 编辑
摘要:在工程目录的src下新建 struts.xml /error.jsp Hell... 阅读全文
posted @ 2013-12-10 14:10 剑握在手 阅读(293) 评论(0) 推荐(0) 编辑

返回顶部↑
点击右上角即可分享
微信分享提示