![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Struts2
文章平均质量分 79
wangxr66
这个作者很懒,什么都没留下…
展开
-
struts1安全问题,和struts2的区别
struts 1.x的一个安全性问题是值得注意的。因为过去的模式是前台页面数据通过actionForm传入,action中的excute方法接收,这个问题是不存在的。 但是,如果在action 中直接定义实例变量,问题就很大了。原因其实也很简单: 为了确保线程安全(thread-safe),在一个应用的生命周期中,Struts框架只会为每个Action类创建一个Action实例(与...原创 2012-05-28 10:21:47 · 156 阅读 · 0 评论 -
Struts2的iterator各种用法
4、普通属性public String execute(){ username = "zhangsan"; password = "123";} 5、自定义对象public String execute(){ userInfo = new UserInfo(); userInfo.setUsername("hhh"); userIn...原创 2012-04-20 18:00:57 · 62 阅读 · 0 评论 -
Struts2实现文件上传
Struts2中提供了fileUpload拦截器,为文件上传提供了很大的便利、很简单,实现单个文件和多个文件上传的原理一样,具体详细设计我不再赘述,详见代码。。。(下载后添加Struts2的核心jar包即可使用)...原创 2012-04-18 11:15:25 · 63 阅读 · 0 评论 -
jsp页面中Struts2标签实用注意事项
org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has p...原创 2012-04-17 18:24:31 · 113 阅读 · 0 评论 -
struts2 文件上传 文件大小配置问题
问题描述:struts.xml中设置上次文件最大值 /FileUploadResult.jsp /FileUpload.jsp 500000 //这里配置没有起作用 application/vnd.ms-powerpoint 问题解决方法:在struts.xml中加入 原因:...原创 2012-04-17 18:20:59 · 222 阅读 · 0 评论 -
struts2的codebehind插件
codebehind plugin是一个可以简化struts2配置的插件,虽然不能实现完全意义上的codebehind,至少已经做的不错了,期待新版本:-D 使用步骤: 1.确保你的应用已经可以使用struts2 2.添加struts2-codebehind-plugin-2.0.11.2.jar包到应用中 3.struts.xml中添加配置: 这里的v...原创 2012-04-10 17:56:24 · 244 阅读 · 0 评论 -
Struts2 的result类型
web.xml 中 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter actionPackages struts2 *.action 默认请求的格式:.action1)如果*.action,那么只有...原创 2012-04-10 16:56:15 · 78 阅读 · 0 评论 -
struts2中Action配置
Struts2的核心功能是action,对于开发人员来说,使用Struts2主要就是编写action,action类通常都要实现com.opensymphony.xwork2.Action接口,并实现该接口中的execute()方法。该方法如下: public String execute() throws Exception Struts2并不是要求所有编写的action类都要实现A...原创 2012-04-10 11:53:58 · 195 阅读 · 0 评论 -
struts2.0拦截器token的使用导致数据无法绑定
之前在用struts2.0做表单提交时,为了防止重复提交,使用了自带的token拦截器。拦截器的配置很简单,但是,不知道为什么,使用拦截器后,原本和struts绑定的bean无法完成数据的绑定,实在让人郁闷。 原来的配置如下: Xml代码 <action name="user_save" class=...原创 2012-07-19 18:29:28 · 99 阅读 · 0 评论 -
struts2表单重复提交问题
struts2 使用拦截器来检查表单是否重复提交,它采用同步令牌的方式来实现对表单重复提交的判断。首先需要在表单的form标签中使用 <s:token></s:token>用这个标签会在form中产生两个hide的文本域,并且每次加载页面都会产生不同的token ID<s:token> 标签创建一个新的令...原创 2012-07-19 18:23:19 · 74 阅读 · 0 评论 -
struts.xml详解
一。常量配置 1.在struts2中配置常量的方式有三种: X 在struts.xml文件中配置 X 在web.xml文件中配置 X 在sturts.propreties文件中配置 注意: 1.之所以使用struts.propreties文件配置,是因为为了保持与WebWork的向后兼容 ...原创 2012-06-14 16:27:50 · 66 阅读 · 0 评论 -
struts.properties配置详解
Struts 2框架有两个核心配置文件,其中struts.xml文件主要负责管理应用中的Action映射,以及该Action包含的Result定义等。除此之外,Struts 2框架还包含 struts.properties文件,该文件定义了Struts 2框架的大量属性,开发者可以通过改变这些属性来满足应用的需求。 struts.properties文件是一个标准的Prop...原创 2012-06-08 17:29:59 · 56 阅读 · 0 评论 -
struts2配置文件详解
1) struts-default.xml 这个文件是struts2框架默认加载的配置文件。它定义struts2一些核心的bean和拦截器。 <?xml version="1.0"encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation...原创 2012-06-08 15:59:39 · 91 阅读 · 0 评论 -
struts.devMode
struts.devMode也就是struts的开发模式,默认值为false,这里修改为true就可以了,以后一旦就该这个文件中的配置就不用去重启tomcat,着实方便许多。但是问题也出现了:严重: Exception starting filter struts2 java.lang.NullPointerException 这个属这个属于struts2.1的...原创 2012-04-19 13:46:34 · 96 阅读 · 0 评论