随笔分类 -  Struts2

摘要:1. JSP文件调用格式: 2. struts.xml文件: 3. action文件:和jsp传递过来的name和age一一对应传值进去 Model: 衍伸: DTO:通过DTO new一个User对象出来,把值传过去: newUser(UserDTO dto)() 阅读全文
posted @ 2016-02-20 08:39 wujixing909 阅读(272) 评论(0) 推荐(0)
摘要:1. JSP文件调用格式: <a href="user/user!add?name=a&age=8">添加用户</a> 2. struts.xml文件: <package name="user" extends="struts-default" namespace="/user"> <action 阅读全文
posted @ 2016-02-20 08:25 wujixing909 阅读(548) 评论(0) 推荐(0)
摘要:Myeclipse添加struts包后, 想重新加载的方法: 1. myelicpse,右键项目,选close project 2. 找到项目所在目录, 打开.classpath删除带有struts2 core字样的行,再删除.bak文件 删除.mystrutsdata文件 删除.project里最 阅读全文
posted @ 2016-02-19 17:11 wujixing909 阅读(321) 评论(0) 推荐(0)
摘要:1. 下载jquery.js文件放在webroot下js文件夹里 2. 配置struts.xml: 3. 写AjaxAction.java: 4. jsp前端显示: 阅读全文
posted @ 2016-02-17 10:09 wujixing909 阅读(1099) 评论(0) 推荐(0)
摘要:如何让struts2和servlet的共存 (2013-08-29 14:07:49) 转载▼ 标签: servlet与struts2共存 同时配置struts2与ser servlet访问不到 分类: Struts2 一、问题的提出 先让我们看下web.xml中struts2和servlet的配置 阅读全文
posted @ 2016-02-17 09:01 wujixing909 阅读(228) 评论(0) 推荐(0)
摘要:1. 创建资源文件,放在action包里:App_en_US.properties, App_zh_CN.properties. 在properties界面用add的方式添加变量,添加完成后, 打开source如下: login.username=username\: login.password= 阅读全文
posted @ 2016-02-05 16:58 wujixing909 阅读(319) 评论(0) 推荐(0)
摘要:第一种方式: 重写validation方法, ====验证action中所有的方法: 1. 在UserAction1里重写validation: @Override public void validate() { // TODO Auto-generated method stub if(user 阅读全文
posted @ 2016-02-05 12:24 wujixing909 阅读(227) 评论(0) 推荐(0)
摘要:OGNL: Object Graph Navigation Language index.jsp: <body> 访问属性 <a href="<%=contextPath %>/ognl.action?username=u&password=p">ognl</a> </body> struts.xm 阅读全文
posted @ 2016-02-01 12:11 wujixing909 阅读(219) 评论(0) 推荐(0)
摘要:result type: dispatcher,redirect:只能跳转到jsp,html之类的页面,dispatcher属于服务器跳转, redirect属于客户端跳转 chain: 等同于forwardaction, redirectAction: 客户端跳转到另一个action 还有free 阅读全文
posted @ 2016-02-01 09:34 wujixing909 阅读(222) 评论(0) 推荐(0)
摘要:xml的注释: <!--叨叨叨叨--> web.xml注释格式": <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="h 阅读全文
posted @ 2016-01-29 17:35 wujixing909 阅读(924) 评论(0) 推荐(0)
摘要:当然你也可以用最新的struts2.3,把相应的包拷贝到工作区lib里使用struts2.3.1所需的JAR包commons-fileupload-1.2.2.jarcommons-logging-1.1.1.jarognl-3.0.3.jarxwork-core-2.3.1.jarstruts2-... 阅读全文
posted @ 2016-01-14 16:44 wujixing909 阅读(296) 评论(0) 推荐(0)