struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brown, Melonie S. - Contractor" <Melonie.Br...@forscom.army.mil>
Subject Nested Iterate and Dynamic Radio Button generating
Date Tue, 24 Dec 2002 13:46:38 GMT
We have a client server application that we are taking to the web using
Struts 1.1.

I have the following code using select boxes.  This allows users to set
privilege levels on differing sections of the application when creating new
users.  The only problem is that select boxes require two clicks (one to
select the box and one to select the item) and the users are used to a radio
button interface in the current client server environment. Also, this
requires a leap of faith that these items are going to stay in a one-to-one
matching in the two arrays used to retrieve the values on the form side.  Is
there any way to do this with radio buttons?

I've been through the archives and it looks like it's possible - but only if
we use scriptlets.  Any help would be appreciated.

<logic:present name="menuItems">      
      <logic:iterate id="curLevel" name="menuItems" >
      	
      <tr>
      	<td colspan=4><bean:write name="curLevel" property="id"
/>&nbsp;<bean:write name="curLevel" property="description" /></td>

      	<td>
      	  <html:select name="curLevel" property="privileges">
	      	  <html:option value="FALSE">READ</html:option>	
    	  	  <html:option value="TRUE">WRITE</html:option>
      		  <html:option value="NONE">NONE</html:option>
      	  </html:select>
      	  <html:hidden name="curLevel" property="id"/>      	  	
      	</td>
      </tr>
      
      <logic:present name="curLevel" property="subItems">
	  <logic:iterate id="curGroup" name="curLevel" property="subItems">
      <tr><td>&nbsp;&nbsp;</td>
        	<td colspan=3><bean:write name="curGroup" property="id"
/>&nbsp;<bean:write name="curGroup" property="description" /></td>
        	<td>      	    
      	    	<html:select name="curGroup" property="privileges">
      	  			<html:option
value="FALSE">READ</html:option>	
      	  			<html:option
value="TRUE">WRITE</html:option>
      	  			 <html:option
value="NONE">NONE</html:option>
          		</html:select>
      			<html:hidden name="curGroup" property="id"/>
      		</td>
      </tr>
      
      <logic:present name="curGroup" property="subItems">
      <logic:iterate id="curSection" name="curGroup" property="subItems">
	  <tr><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td>
				<td colspan=2><bean:write name="curSection"
property="id" />&nbsp;<bean:write name="curSection" property="description"
/></td>
				<td>
    		  		<html:select name="curSection"
property="privileges">
      	  				<html:option
value="FALSE">READ</html:option>	
      	  				<html:option
value="TRUE">WRITE</html:option>
      	  				 <html:option
value="NONE">NONE</html:option>
      	  			</html:select>
      	  		<html:hidden name="curSection" property="id"/>
      			</td>
      </tr>
      
      <logic:present name="curSection" property="subItems">
      <logic:iterate id="curPage" name="curSection" property="subItems">
	
<tr><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td>
				<td><bean:write name="curPage" property="id"
/>&nbsp;<bean:write name="curPage" property="description" /></td>
				<td>
    		  		<html:select name="curPage"
property="privileges">
      	  				<html:option
value="FALSE">READ</html:option>	
      	  				<html:option
value="TRUE">WRITE</html:option>
      	  				<html:option
value="NONE">NONE</html:option>
      	  			</html:select>
      	  			<html:hidden name="curPage" property="id"/>

      			</td>
      </tr>
      
       </logic:iterate>
       </logic:present> 
        </logic:iterate> 
         </logic:present> 
         </logic:iterate> 
      </logic:present> 
      </logic:iterate> 
   </logic:present> 
      </logic:iterate> 
   </logic:present> 
   </table> 
           			
   		<html:submit property="submit" value="save"/>
		</html:form>




Melonie Brown
Programmer Analyst
(404) 464-6216



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message