You might try using a more specific title line.

We'd all be better off if you asked a direct question, as opposed to having
us scan all of your code for anything that might be wrong.  Is this code not
working?  If not, what is happening?  Are you getting any specific error
messages?

Are you including the correct taglibs on your JSP page, and the correct jar
files in your WAR?

Note that the "html:checkbox" tag will only add the 'checked="checked"'
attribute if the value of your property is "true", "yes", or "on" (which has
always bothered me somewhat, although I haven't experimented with this
enough to figure out what would be a better strategy).

If all else fails, it's always handy to have your debugger set up to debug
your application, INCLUDING the Struts source code (associated with the
release that you're using) so you can see for yourself exactly what
decisions are made in the code.

> -----Original Message-----
> From: kiuma [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 11:07 AM
> To: Struts Users Mailing List
> Subject: Re: Damn where is bug in my code????
> 
> 
> Please tell me if there is an error in this code
> 
> kiuma wrote:
> 
> > 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]>
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

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

Reply via email to