Struts2
cy913417
这个作者很懒,什么都没留下…
展开
-
学习Struts2的autocompleter使用
Struts2的ajax主题在使用autocompleter 做联动效果如下所示时: <form id="selectForm"> 请选择您喜欢的作者:<br> <s:autocompleter name="author" list="{'auth1','auth2' , 'auth3'}" value="auth1" notifyTopi原创 2011-12-16 16:44:31 · 146 阅读 · 0 评论 -
Struts2 指定某些请求或servlet不被拦截
在正常的项目运行中,有时我们需要某些特定的url或者servlet 或者静态资源不被struts2的过滤器所拦截 2.1.8以后貌似可以在配置文件中直接配置 在Struts2中的配置文件中配置将servlet或指定资源排除: struts.action.excludePattern=/js/.* struts.action.excludePattern=/aaa/bbb.cc ...2013-05-06 17:44:28 · 1153 阅读 · 0 评论 -
struts2异常There is no Action mapped for namespace * and action name
解决There is no Action mapped for namespace * and action name (* 代表异常namespace名称) 参照上一篇博客中关于namespace访问顺序,可知,在每次报次异常之前都会先去访问namespace=“”的package 所以,我们可以在struts.xml文件中配置一个默认namaspace <package nam...2012-03-19 15:51:07 · 105 阅读 · 0 评论 -
Struts2 中namespace 搜索action顺序
关于 Struts2 中namespace 搜索action顺序 大致思想类似递归搜索,网络上有前辈已总结好: 自此仅作引用不在赘述: http://www.cnblogs.com/lich/archive/2011/12/08/2281346.html 写道 让我们来看一下Action名称的搜索顺序 1.获得请求路径的URI,例如url是:http://server/struts2/...原创 2012-03-19 15:23:36 · 63 阅读 · 0 评论 -
利用Struts2 sort标签对指定集合元素t排序
sort标签可用于对指定的集合元素进行排序,排序时,我们必须提供自己的排序规则,及实现自己的Comparator, 自己的Comparator需要实现java util 包下的Comparator接口。如下所示: public class ContentComparator implements Comparator<Content> { public int compare(...原创 2012-03-19 09:02:27 · 218 阅读 · 0 评论 -
Struts2 urlrewrite 多个参数 outbound-rule
struts2 在页面结合其自身的标签, 使用urlrewrite 相当方便,鄙人也是初次使用。google一下 一搜一箩筐,基本都是a抄b b复制c c 粘贴a d收藏c,(再次吐槽那些只会ctrl+c and ctrl+v的XXX)完了都是只有 <rule> <note>ContentInfo_contentId_page</note> ...原创 2012-05-15 15:06:14 · 249 阅读 · 0 评论 -
struts2 循环标签之元素索引
<!-- 在页面中实现自动增加的序号用iterator的statuts的index属性 --> <s:iterator value="list" status="index" id="stat"> <!-- 返回当前迭代元素的索引 --> <s:property value="#index.index"原创 2012-02-01 10:59:08 · 141 阅读 · 0 评论 -
No result defined for action * and result success
近日在做Struts2+Spring3+Mybatis3框架整合是遇到此问题, 检查良久,发现只要在项目中加入struts2-convention-plugin-2.1.8.1.jar就会抛出No result defined for action * and result success异常,其中* 代表我的action。解决办法有二: 1,配置namespace,则在正常的namespac...原创 2012-05-08 08:37:11 · 119 阅读 · 0 评论 -
Struts2 返回json对象
struts2 在返回json是默认会将action中get set 全部返回,有时我们仅仅只需要返回验证结果而已,对此可以在result中配置 指定需要返回结果。 <!-- 封装所有的get开头的方法 --> <result type="json" name="user"> </result> <!-- 只包含user.id属性 -->...原创 2012-04-27 13:25:12 · 74 阅读 · 0 评论 -
struts2 遍历Map最全的总结 .
Struts2中iterator标签遍历map总结 针对以下几种情况的Map: private Map<String,String> map; private Map<String,Student> studentMap; private Map<String,Strin...原创 2012-01-14 16:53:42 · 93 阅读 · 0 评论 -
Struts2.1.8 客户端验证 validation
Struts2.1.8 在做客户端验证时,当form中给定 validation=“true”时,通过jsp页面访问会报一下异常: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on or...原创 2011-12-27 12:58:51 · 112 阅读 · 0 评论 -
Struts2的服务端验证(validation)
最近在做Struts2的服务端验证小demo时,遇到一个错误: ognl.MethodFailedException: Method "setAge" failed for object demo.demo_11_6.lee.RegistAction@d2b116 [java.lang.NoSuchMethodException: demo.demo_11_6.lee.RegistActi...原创 2011-12-27 12:52:43 · 87 阅读 · 0 评论 -
struts2 ognl 正则去html标签字符串截取
<s:property value="#con.body.replaceAll('<[^>]*>','').replaceAll(#con_title,'').substring(0,100)+'...'" escape="false"/> 去html标签并去掉第一个与#con_title重复的内容,然后截取前100...原创 2012-09-12 09:54:05 · 199 阅读 · 0 评论