技巧摘录

1。<html:radio>标签如何能让其中的一个radio是初始时候就是选中的

<html:radio property="radioVar" value="Value1"/>
<html:radio property="radioVar" value="Value1"/>

加上一个name 属性就可以了.

<html:radio property="radioVar" name='XXXX' value="Value1"/>

然后在显示之前给 name 设置值

2。form与循环

今天发现,要用循环实现多个form(可修改的)列表,<form>标签一定要在循环内:例如

 for (int i = 0; i < ar.size(); i++) {
     customer = (CustomerEditForm) ar.get(i);
     cuId = customer.getCu_id();
     cuCode = customer.getCu_code();
     cuName = customer.getCu_name();

     cuPassword = customer.getCu_password();
     cuPhone = customer.getCu_phone();

     session.setAttribute("cu_id", Integer.toString(cuId));
     %>
 <!-- info(edit) form start-->
 <html:form action="/customerEdit">

  <jsp:setProperty name="customerBean" property="cu_id"
   value="<%=cuId%>" />
  <jsp:setProperty name="customerBean" property="cu_name"
   value="<%=cuName%>" />
  <jsp:setProperty name="customerBean" property="cu_old_name"
   value="<%=cuName%>" />
  <jsp:setProperty name="customerBean" property="cu_password"
   value="<%=cuPassword%>" />
  <jsp:setProperty name="customerBean" property="cu_phone"
   value="<%=cuPhone%>" />

  <tr><td><%=cuCode%></td>
   <html:hidden name="customerBean" property="cu_id" />
   
   <!-- 用户名可改否?此处设置为不可改 -->
   <td><%=cuName %>
   <html:hidden name="customerBean" property="cu_name" />
   <html:hidden
    name="customerBean" property="cu_old_name" /><!-- for name check in DriverEditAcion --></td>
    
    
   <td><html:text property="cu_password" name="customerBean" /></td>
   <td><html:text property="cu_passwordconfirm" name="customerBean" /></td>
   <td><html:text property="cu_phone" name="customerBean" /></td>
   <td><html:submit property="editAction">
    <bean:message key="manage.user.customer.edit" />
   </html:submit></td>
   <td><html:submit property="editAction">
    <bean:message key="manage.user.customer.delete" />    
   </html:submit></td>
  </tr>
 </html:form>
 <!--form end -->

 <%}%>

3.http://www.matrix.org.cn/thread.shtml?topicId=3062&forumId=22 循环中的form取值的探讨

ActionForm:

private String[] quantity;
public String[] getQuantity() {return quantity;}
public void setQuantity(String[] quantity) { this.quantity = quantity; }

待验证

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值