Using checkbox in struts out batch delete

Using checkbox in struts out batch delete

  <html:form StyleId = "delForm" action="/">
      <logic:iterate name="categories" >
            <td<input type="checkbox" name="ids" value="<bean:write name="category" property="id" />">td>
    <input type = "checkbox" name="isSelected" value = "true"
                          onclick = "if(delForm.isSelected.checked == true)
                                      {for (var i = 0; i < delForm.ids.length; i ++){delForm.ids[i].checked = true;}}
                                     else{for (var i = 0; i < delForm.ids.length; i ++){delForm.ids[i].checked = false;}}"/>                                              Select all  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;    <a href="javascript:if(confirm(' Do you really want to delete the selected column  ?'))delForm.submit()"> Delete all the selected columns  </a>

FormBean (I use DynaActionForm, it is configured in struts-config.xml)

<form-bean name="testingForm"  type="org.apache.struts.action.DynaActionForm">
    <form-property name="id"     type="java.lang.String"/>
    <form-property name="ids"    type="java.lang.Long[]"/>
  </form-bean> Action
    public ActionForward execute(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response)
        throws Exception {
        //  Gets the operation name
        DynaActionForm dyna = (DynaActionForm) form;
        // ids Array is an array of all the selected records the ID value of the
        Long[] ids = (Long[]) dyna.get("ids");
       //  Call the corresponding dao method  , Complete removal of all specified ID action
       return mapping.findForward(".....");
分类:Java 时间:2010-04-01 人气:421
blog comments powered by Disqus


  • [Java Web]web.xml文件详解 2014-06-28

    1.web.xml <web-app xmlns="" xmlns:xsi="" xsi:schemaLocation="" ve

  • Struts.config.xml configuration Daquan 2010-10-25

    Is the core of Struts struts-config.xml configuration file, in this document describes all the Struts components. Here the main components, including configuration and minor components, is the struts-config.xml contains the following key elements of

  • 如何用正则取input type="text"中的value 2014-02-04

    1.如何通过正则取input type="text"中的value呢? 2.如何过滤掉input type="checkbox"的标签? 这样只能达到正则取input type="text"中的value可是不能过滤掉input type="checkbox"的标签! alert [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] alert [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 解决: aler

  • 判断多个input type=file是否有已经选择好文件的代码 2014-03-10

    在each中使用return false退出循环,使用return true结束当前次循环,进行下一次循环 表单中有多个<input type="file" name="uploadfile" contentEditable="false" style="width:80%">, 提交表单时需要判断其中至少要有一个input已经选择好文件. <input type="file" name=

  • JS清空上传控件input(type="file")的值的代码第1/2页 2014-04-29

    最近做的一个小功能,需要清空<input type="file">的值,但上传控件<input type="file">的值不能通过JavaScript来修改. google找到这样一个解决方法: 在上传控件中插入了值,就只能通过form的reset功能来清空了,但是form里面其他的值也被reset了. 既然可以使用form的reset清空,那就有办法了:新建一个临时form,然后将需要清空的上传控件移入其中,reset之后,再移回原来所在

  • input type=submit 的小问题 2013-07-16

    以前使用strtus2时,在jsp页面中有input时要去name才可以保证数据不会被提交到服务器,一直没有弄明白为什么会这样的,看到一段解释明白了. HTML元素 - input type=submit 定义 创建一个按钮,点击该按钮后,即提交表单. Creates a button that, when clicked, submits the form. 注释 使用 VALUE 标签属性将创建无法由用户编辑的显示标签.默认的文字是 Submit Query.如果用户单击提交按钮提交了表单,

  • The type java.lang.Object cannot be resolved.It is 2009-10-26

    Thank you for the inaction of Quote 1, The type java.lang.Object cannot be resolved.It is indirectly referenced from required.class files. Information appear to be happening because you installed multiple versions of the relationship between the jre

  • The type java.lang.Object cannot be resolved It is indirectly referenced ... 2010-03-25

    The type java.lang.Object cannot be resolved. It is indirectly referenced from required. Class files When you reference different versions of the JDK in the Eclipse projects, the problem occurs. The application development environment because you hav

  • Error!] The type java.lang.object cannot be resolved. It is indirectly referenced 2011-09-19

    MyEclipse following error when importing a project, checked, import all the normal package Error!] The type java.lang.object cannot be resolved. It is indirectly referenced from required. Class files Looking for a long time, it was found, the origina

  • Java学习之Xml系列一:初始步骤.查询元素及属性.遍历元素 2014-07-22

    话不多说,全在代码和注释说明里了. DTD文件:SwordTypeDefinition.dtd <?xml version="1.0" encoding="UTF-8"?> <!ELEMENT SwordLibrary (Sword*)> <!ELEMENT Sword (SwordName,Price,Attack)> <!ELEMENT SwordName (#PCDATA)> <!ELEMENT Price

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.486 (s). 12 q(s)