Using checkbox in struts out batch delete

sponsored links
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(".....");
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Using checkbox in struts out batch delete

  • Hibernate configuration parameters

    Hibernate in the configuration file: <properties> <property name="" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @

  • myeclipse plugin

    myeclipsePlug-ins? 1.tomcatPlugin(Start tomcat ):http ://,2.xVersions of eclipse 3 version 2 .1Version doesn't work. 2.Lomboz(Development of jsp program ,jspDynamic prompt, debugging ):

  • hibernate generic generic DAO

    package org.lzpeng.dao; import; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

  • Great collection of java interview topics

    1, object-oriented features of what has 1. Abstract: Abstract is that it has overlooked a subject has nothing to do with the current goal of those aspects in order to more fully with the current objectives of the attention-related aspects. Abstract does n

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries