1.Struts2标签中访问静态变量或者方法
:
例如:
<s:proptery value="@cn.com.victorysoft.datasource.standard.action.StorageClass@STATIC_NAME"/>
<s:if test="#session.deptid==@cn.com.victorysoft.datasource.standard.action.StorageClass@STATIC_NAME"></s:if>
<s:iterator id="show11" value="@cn.com.victorysoft.datasource.standard.action.StorageClass@STATIC_NAME"></s:iterator>
注意:
1.访问的类名必须是全称。是@cn.com.victorysoft.datasource.standard.action.StorageClass而不是@StorageClass
2.在版本2.1.2中,如果要通过ognl访问静态方法,必须在struts.properties或者struts.xml中将选项struts.ognl.allowStaticMethodAccess设置为true
2.直接访问jsp出现异常:
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 passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
解决方法:在web.xml中加一个过滤设置
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
3.if标签判断一个字符串是否包含一个字符串
<s:if test="#str.indexOf('abc')>=0">
yes
</s:if>
<s:else>
no
</s:else>
4.No result defined for action and result input
一种原因是struts2的action及返回值的配置有问题,仔细检查。
如果发现配置没有问题,很大可能是页面提交的from的数据有问题,比如:
<input type="text" name="userId" value="<%=userId%>"/>
仔细检查jsp页面中from的数据,当然,在struts2的xml配置文件中加上:
<result name="input">/error.jsp</result>
把错误返回到页面,就一目了然了。
很明显,这是输入异常的一种。
分享到:
相关推荐
struts2标签库struts2标签库struts2标签库struts2标签库
struts2标签使用例子 struts2标签使用例子 struts2标签使用例子struts2标签使用例子
主要介绍了struts2的标签的详细使用例子说明
struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签struts1标签
Struts2标签库Struts2标签库Struts2标签库Struts2标签库Struts2标签库Struts2标签库
STRUTS:struts2标签库
struts标签库struts标签库struts标签库struts标签库struts标签库struts标签库struts标签库struts标签库
有关、相关、类似这样的Struts 2标签库的详细介绍。
Struts2标签库的组成 Struts2框架的标签库可以分为以下三类: 用户界面标签(UI标签):主要用来生成HTML元素的标签。 表单标签:主要用于生成HTML页面的FORM元素,以及普通表单元素的标签。 非表单标签:主要用于生成...
JSP_struts2标签大全
可对struts2 标签如等相应列进行求和.
struts2 标签库介绍(html)对Struts2的标签做了详细的介绍让你轻松掌握Struts2的标签。 STRUTS2学习文档.pdf 对Struts2的一些配置文件进行了详细的说明。 Struts2―表单验证validate(html)对validate的type属性...
史上最全的struts2标签史上最全的struts2标签
struts2标签+ tiles lib
struts2标签使用方法以及el表达式的使用,整理收集供参考
struts2标签详解(经典)struts2标签详解(经典)struts2标签详解(经典)
利用Struts 2标签创建ex3.jsp页面,此页面提交给tag.action,在structs.xml中配置这个action的转发视图为result.jsp在result.jsp页面中显示ex3.jsp页面控件的值。(源代码和实验报告)
Struts2标签详解及具体实例解析,可作为Struts2标签的帮助文档,而且还有具体实例解析
自制的struts2标签chm格式,可以方便快速查询查看
Struts2标签与开发手册 Struts2标签与开发手册 Struts2标签与开发手册 Struts2标签与开发手册