struts1.x标签的用法

首先是<html:select>的用法

<html:select property="comp_Version" styleClass="borderon">
<html:option value="0" >所有安装版本</html:option>
<html:option value="1" >安装版本未知</html:option>
<logic:notEmpty name="versionList">
<html:options collection="versionList" property="version" labelProperty="version"></html:options>
</logic:notEmpty>
</html:select>
//这里的versionList不是formBean里面得值,而是request或session中的集合。


下面是一个组合使用<logic>和<bean>

<logic:present name="userComputerEditForm" property="list">
<logic:iterate id="computerInfo" name="userComputerEditForm" property="list">
<tr align="center" onMouseOver="this.style.backgroundColor='#99DDFF'" onMouseOut="this.style.backgroundColor=''">
<logic:empty name="computerInfo" property="computername">
<td class="gray">机器名为空</td>
</logic:empty>
<logic:notEmpty name="computerInfo" property="computername">
<td><bean:write name="computerInfo" property="computername"/></td>
</logic:notEmpty>
<td><bean:write name="computerInfo" property="userName"/></td>
<td><bean:write name="computerInfo" property="setuptime" format="yyyy-MM-dd"/></td>
<td><bean:write name="computerInfo" property="version"/></td>
<td><bean:write name="computerInfo" property="ipaddress"/></td>
<td><bean:write name="computerInfo" property="isactivate"/></td>
<td><bean:write name="computerInfo" property="isOnline"/></td>
<td><html:link action="/gotoComputerSetAction" paramId="id" paramName="computerInfo" paramProperty="computerId">设置</html:link></td>
<td><html:link action="/showUserVirComAction" paramId="id" paramName="computerInfo" paramProperty="computerId">设置</html:link></td>
</tr>
</logic:iterate>
</logic:present>

//注意 <bean:write>的format属性 他只能转换时间类的值


下面是一组<logic:equal>

<logic:equal name="computerInfo" property="version" value="0">
<td><span class=gray>未知</span></td>
</logic:equal>
<logic:notEqual name="computerInfo" property="version" value="0">
<td><bean:write name="computerInfo" property="version"/></td>
</logic:notEqual>


下面是一个用<html:link action="">传值的例子

<html:link action="/gotoComputerSetAction" paramId="id" paramName="computerInfo" paramProperty="computerId">设置</html:link>
//paramId这个属性后面跟的就是你在action中要用request.getParameter("id")
抓的
//paramName这个属性后面跟的是与action绑定的form名或者是在用 <logic:iterate>
遍历时的id的值
//paramProperty这个属性就是form里的属性或是用 <logic:iterate>
遍历时的id的属性

如果要在链接后面传多个值的话我都是用${}来解决的
<html:link href="/xxx.do?xxx=${}&xxx=${}">


我就总结了几个比较常用的
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值