struts标签处理小问题

来源:互联网 发布:淘宝行业分析软件 编辑:程序博客网 时间:2024/04/30 13:04

1、截取字符串长度

<s:property value="incod.substring(0,incod.length()>5?5:incod.length())" />

其中incod是Action里面的属性,该操作截取的是incod前5个字符的数据

<s:property value="wscname.substring(0,wscname.indexOf('污水处理厂')>0?wscname.indexOf('污水处理厂'):wscname.length()-1)" />

去掉字符串中包含污水处理厂及后面的字符

2、在struts的form表单里面,如果这样写<s:textfield name="user.name" label="用户名"/>的话,则会首先user对应action中的User对象生成的实例,其次是user实例中的那么属性,也就是说,form表单提交到后台的时候可以直接生成一个对象并且为该对象的属性赋值

 

3、iterator控制迭代次数问题:<s:iterator value="diys" status="d" begin="0" end="10" step="1">

0 0
原创粉丝点击