一直都用jsf的xhmtl格式,最近用jsp页面,遇到点麻烦,请教大家:要把List<CustomerBean>对象展示到table里边,并且最后包含对该列CustomerBean对象操作按钮,如编译、删除等等。
动态显示可以做出来,但操作怎么写呢?类似于jsf里边这样的效果:
<h:column>
<h:commandLink value="编辑">
<f:setPropertyActionListener target="#{bcust.selectedCust}"value="#{cust}" />
</h:commandLink>
</h:column>
动态显示可以做出来,但操作怎么写呢?类似于jsf里边这样的效果:
<h:column>
<h:commandLink value="编辑">
<f:setPropertyActionListener target="#{bcust.selectedCust}"value="#{cust}" />
</h:commandLink>
</h:column>
如果方便,给个js的demo吧~
记事本随手写的。
楼主参考下吧。删除的话带Id直接到action请求。
<html>
<head>
<title>Demo</title>
<script type="text/javascript">
function update(temp){
temp.readOnly = false;
}
</script>
</heand>
<body>
<form action="testAction" method="post">
<table>
<tr>
<td>name</td>
<td>age</td>
<td>function</td>
</tr>
<tr>
<td><input readonly="readonly" name="userName" value="${user.userName}" onclick="update(this);"/></td>
<td><input readonly="readonly" name="userAge" value="${user.userAge}" onclick="update(this);"/></td>
<td><input type="submit" value="submit update"></td>
</tr>
<table>
<form>
</body>
</html>