I don't want to join the chorus, but isn't the first question "Why should 
the boxes be checked?"?  What in this code makes you think those boxes will 
be checked?  Maybe we should start there?

At 12:41 PM 10/16/2002 +0800, you wrote:
>I cant be bothered reading the code, but my guess is "Yes".
>
>btw: Do we get a prize if we guess correctly?
>
>-----Original Message-----
>From: kiuma [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, October 16, 2002 02:07
>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 =
>Session.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]>

Micael

-------------------------------------------------------

This electronic mail  transmission and any accompanying documents contain 
information belonging to the sender which may be confidential and legally 
privileged.  This information is intended only for the use of the 
individual or entity to whom this electronic mail transmission was sent as 
indicated above. If you are not the intended recipient, any disclosure, 
copying, distribution, or action taken in reliance on the contents of the 
information contained in this transmission is strictly prohibited.  If you 
have received this transmission in error, please delete the message.  Thank you 



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

Reply via email to