You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jurkan, Aneta" <An...@edbasa.no> on 2001/09/19 11:34:47 UTC

Dynimic checkboxes

How can I read the value of dynamic checkboxes from a form?

The following code from my jsp-file writes out the checkboxes dynamically:

<logic:iterate id="roleSelection" name="roles">
	<html:checkbox name="roleSelection" property="userRoleId"/>
	<bean:write name="roleSelection" property="userRoleName"/><br>
</logic:iterate>

This is working just fine, but the problem is how to check which of the
boxes have been selected and how to set a checkbox to CHECKED in my
java-code.

What do I put in the following functions in my Form-class:

public void setRoleSelected(int index)
{
	???	    
}
	
public int getIsRoleSelected(int index)
{
       	???
} 



All user's roles

Posted by Mike Douglass <do...@rpi.edu>.
Is there any way to get all roles for a currently authenticated user?

We are about to implement a jsp application which allows a user to select 
one of a number of roles which will determine the functionality available 
in later pages.

Essentially, I want to create a drop down box of all valid roles for the 
current user without having to build the names of all possible roles into 
the page source.



Mike Douglass				douglm@rpi.edu
Senior Systems Programmer	
Communication & Collaboration Technologies	518 276 6780(voice) 2809 (fax)
Rensselaer Polytechnic Institute 110 8th Street, Troy, NY 12180