struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heligon Sandra <>
Subject Select all / Unselect all check-box in a table
Date Wed, 26 Mar 2003 16:39:24 GMT

	I have to implement the following JSP page:

	Id       Name	Select

	1        Toto          [ ]
	2        Tata	  [*]
            3        Tata	  [ ]

	<<select all>>  <<unselect all>> <<edit>> <<load>>

	The JSP page is composed of a table and multiple commands. One of
the column is a check-box column.

	I have defined the following DynaVaildatorForm:

	<form-bean name="myForm" dynamic="true"
  		<form-property name="items" type="java.util.ArrayList" />
		<form-property name="selected" type="java.lang.String[]" />

	And the code of the JSP is the following:
            <html:form action="/" method="GET">  
	<logic:iterate name="myForm" id="items" property="items"
		<tr bgcolor="#EBEBEB">
		    <td bgcolor="#EBEBEB" width="9%"> 
		        <bean:write name="items" property="id"/>

                            <td bgcolor="#EBEBEB" width="9%"> 
		        <bean:write name="items" property="name"/>

		     <td bgcolor="#EBEBEB" width="10%">
   			<html:checkbox name="myForm" property="selected"
	<table width="100%" border="0" cellpadding="0" cellspacing="0"
	    <td align="right" valign="top" width="10%"> 

	The Action class

	public class CallLookupDispatchAction extends DispatchAction 
		protected Map getKeyMethodMap() 
		     Map map = new HashMap();
		     return map;   

		public ActionForward lookupSelectAllConnection(ActionMapping
mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception 

		public ActionForward
lookupUnselectAllConnection(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception 

	I know that many messages were exchanged about "Multiple submit" but
it is not obvious to understand the best choice.

	For the buttons SelectAll /  unselect all I am not certain that is
the LookupDispatchAction is the best way of making. 
	Perhaps it is necessary to do everything on the client side and not
call the web server, is it the case ?
	To select all or unselect all the check-box of the JSP page do I
have to call a method like 
	BeanUtils.setProperty(form, "selected", ...);
	How can I know the number of records of my form ?
	If someone has a example of a such application, thanks a lot to send


As of February 12th, 2003 Thomson unifies its email addresses on a worldwide
Please note my new email address: 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message