If I understand your questions correctly, you can define two String arrays in your 
form bean, one for allRoles, and the other for selectedRoles, which is the array of 
roles of the current user. Before forwarding to your jsp, in your action class, you 
can retrive all the roles of the currently user, and set the roles to the 
selectedRoles in the form bean.

HTH,
Saul

  ----- Original Message ----- 
  From: Amish Patel 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, March 14, 2004 11:59 AM
  Subject: Multibox and selected values


  Hello All,

  I am running into this problem, that I am not able figure out how to do it 
  properly.  I have searched the web and have not found a decent example.  
  What I am trying to do is use html:multibox taglib to display a set of 
  checkboxes.  These check boxes represent the user's security preferences.  
  So if the user has a particular security token, then the respective check 
  box should be checked.

  In order for this to work properly, I have to get two things, all the 
  security tokens that exits in the system.  And I  have to get the security 
  tokens that the user already has.  In my ActionForm, I have two methods:  
  one that gets all the security tokens in the system and second that gets 
  only the tokens that the user has.   The following is what I am using in my 
  jsp to display checkboxes.

  <logic:iterate name="associateUserRoleForm" property="allRoles" 
  id="element">
    <html:multibox property="selectedRoles">
     <bean:write name="element" />
    </html:multibox>
    <bean:write name="element" />
    <br />
  </logic:iterate>


  Right now I am able to get allRoles successfully, but in order to retrieve 
  the selectedRoles, I need a way such that my ActionForm 
  (associateUserRoleForm) can get hold of this user or this user's id, which 
  is already in the session.  Once I get this I can then display all the 
  security tokens and check those tokens that the user already has.

  How can I do this?  Am I on the right track or is there a better way to do 
  this?

  Thank You very much for your help!
  -Semplice

  _________________________________________________________________
  Get business advice and resources to improve your work life, from bCentral. 
  http://special.msn.com/bcentral/loudclear.armx


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to