Hi, now I've the following problem:

in my jsp page I have

<c:set var='allGroups' value='${sessionScope.userEditForm.allGroups}'/>
....
...
<c:forEach items="${allGroups}" var="permission">
  <tr>
    <td align='left'>
      <html-el:checkbox property="principalPermissions" 
value="${permission}">
        <c:out value='${permission}'/>
      </html-el:checkbox>
    </td>
  </tr>
</c:forEach>

in the OpenEditAction I write:

try {
            Collection cAllRolesData = cSession.getAllGroups();           
            Iterator iter = cAllRolesData.iterator();
            UserGroupsData gData;
            while (iter.hasNext())
            {
                gData = (UserGroupsData)iter.next();               
                uForm.setAllGroups( gData.getDescription() 
);                               
            }           
        } catch (Exception e) {          
        }

and It correcty fills the list.

Then I try to fill check values:

Iterator iUserRoleData = cSession.getUserRoles( uData.getPrincipalId() 
).iterator();
           
            while (iUserRoleData.hasNext())
            {
                RoleData rData;
                rData = (RoleData)iUserRoleData.next();
                System.out.println( "Group: " + rData.getRoleGroup() );
                if ( rData.getRoleGroup().equals("Roles") )
                {
                    uForm.setPrincipalPermissions( rData.getRoleName() );
                    System.out.println( "Name: " + rData.getRoleName() );
                }
            }  

This list is filled, but check boxes are not checked. Why??
Please help me.
/*
 * OpenUserEditAction.java
 *
 * Created on 9 settembre 2002, 14.16
 */

package com.wingstech.webappointments;

import org.apache.struts.action.*;
import org.apache.struts.util.MessageResources;
import javax.servlet.http.*;
import com.wingstech.webappointments.utils.*;
import com.wingstech.webappointments.interfaces.*;
import javax.naming.*;
import java.util.*;
import org.w3c.dom.*;

import javax.ejb.CreateException;
import javax.naming.NamingException;

/**
 *
 * @author  kiuma
 */
public class OpenUserEditAction extends Action {
        
    
    public ActionForward execute( ActionMapping mapping,
                                  ActionForm form,
                                  HttpServletRequest req,
                                  HttpServletResponse res ) throws Exception 
    {        
        UserEditForm uForm = ((UserEditForm)form);   
        uForm.resetFields();
        UserData uData;
        UserSessionHome lHome;
        String principalId = "";
        HttpSession hSession = req.getSession(true); 
        if (req.getParameter("principalId") != null) 
            principalId = req.getParameter("principalId");
    
        try {
            lHome = (UserSessionHome)
                HttpSessionEJBHomeFactory.getHome(
                        "UserSession", UserSessionHome.class);
        }  catch (Exception e) {
            return mapping.findForward( IStrutsConstants.FAILURE );
        } 
        
        UserSession cSession = lHome.create();
        Collection cAllRoles = new Vector();
       
        try { 
            Collection cAllRolesData = cSession.getAllGroups();            
            Iterator iter = cAllRolesData.iterator();
            UserGroupsData gData;
            while (iter.hasNext())
            {
                gData = (UserGroupsData)iter.next();                
                uForm.setAllGroups( gData.getDescription() );                          
      
            }            
        } catch (Exception e) {           
        }
        
        if (principalId.equals(""))
        {                  
            return mapping.findForward( IStrutsConstants.SUCCESS );
        } 
        
        
        try {
            uData = cSession.getUserByPrincipalId( principalId );
           
            uForm.setPrincipalId( uData.getPrincipalId() );
            uForm.setPasswd1( uData.getPassword() );
            uForm.setPasswd2( uForm.getPasswd1() );
            uForm.setName1( uData.getName1() );
            uForm.setName2( uData.getName2() );
            uForm.setCf( uData.getCf() );
            uForm.setPiva( uData.getPiva() );
            uForm.setAddress( uData.getAddress() );
            uForm.setZip( uData.getZip() );
            uForm.setCity( uData.getCity() );
            uForm.setState( uData.getState() );
            uForm.setCountry( uData.getCountry() );
            uForm.setTel( uData.getTel() );
            uForm.setWeb( uData.getWeb() );
            uForm.setMail( uData.getMail() );
            
            Iterator iUserRoleData = cSession.getUserRoles( uData.getPrincipalId() 
).iterator();
            
            while (iUserRoleData.hasNext())
            {
                RoleData rData;
                rData = (RoleData)iUserRoleData.next();
                System.out.println( "Group: " + rData.getRoleGroup() );
                if ( rData.getRoleGroup().equals("Roles") )
                {
                    uForm.setPrincipalPermissions( rData.getRoleName() );
                    System.out.println( "Name: " + rData.getRoleName() );
                }
            }                        
            
            try {
                if ( cSession.isUserEnabled(uData.getPrincipalId()) ) 
                {
                    uForm.setUserEnabled( true );
                }
            } catch (Exception e) {}
       
            
        } catch (Exception e) {
            return mapping.findForward( IStrutsConstants.FAILURE );
        }

        return mapping.findForward( IStrutsConstants.SUCCESS );
    }
        
    
}

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

Reply via email to