I sort of think it is the way I did my SelectUsersForm
because the boolean selected is defined in another
Java class.  Please see the attachments.  But, the
checkbox worked without any problem if it is not
preceded by a form.

My struts-config.xml looks like:
<struts-config>
        <form-beans>
                ....
             <form-bean
                name="SelectUsersForm"
               
type="gov.cbp.ace.st.tf.web.admin.form.SelectUsersForm">
             </form-bean>
             <form-bean
                name="FindUsersForm"
               
type="gov.cbp.ace.st.tf.web.admin.form.FindUsersForm">
             </form-bean>
                ....
        </form-beans>


        <action-mappings>
        
        <action path="/admin/maintainuser"
type="gov.cbp.ace.st.tf.web.admin.action.ListUsersAction">
                                        <forward name="default"
path="admin.maintainuser.default" />
                                        <forward name="failure" 
path="/admin/adminmenu"
/>
        </action>

                <action path="/admin/findUsers"
type="gov.cbp.ace.st.tf.web.admin.action.FindUsersAction"
                                        name="FindUsersForm"
                                        input="/admin/maintainuser">
                        <forward name="default"
path="admin.foundusers.default" />
                </action>
           
                <action path="/admin/selectUsers"
type="gov.cbp.ace.st.tf.web.common.action.TFNoOpForwardAction"
                                        name="SelectUsersForm"
                                        scope="session"
                                        input="/admin/maintainuser">
                        <forward name="default"
path="admin.selectedusers.default" />
                </action>
           
        </action-mappings>
        
</struts-config>


--- Michael Jouravlev <[EMAIL PROTECTED]> wrote:

> Would be nice to see your <form-beans> and <action>
> definitions.
> 
> On 6/29/06, Caroline Jen <[EMAIL PROTECTED]>
> wrote:
> > Yes, the second form is defined inside the
> > <form-beans> and also refered in the action
> mapping.
> > But, the new runtime JSP error is: cannot retrieve
> > definition for form bean null on action
> > /admin/selectUsers.do"
> >
> > --Caroline
> >
> > --- Michael Jouravlev <[EMAIL PROTECTED]> wrote:
> >
> > > Make sure that you have refer to a form bean in
> the
> > > "selectUsers"
> > > action mapping.
> > >
> > > On 6/29/06, Caroline Jen <[EMAIL PROTECTED]>
> > > wrote:
> > > > Ed, your suggestion makes sense.
> > > >
> > > > I have created a second form on the page by
> adding
> > > > <html:form action="/admin/selectUsers.do">
> before
> > > the
> > > > <c:forEach> and change the <html:link> to
> > > > <html:submit> followed by
> > > > </html:form>.  The second form is defined
> inside
> > > the
> > > > <form-beans> and also in the action mapping.
> > > >
> > > > This time, I got another kind of JSP runtime
> > > error:
> > > > "cannot retrieve definition for form bean null
> on
> > > > action /admin/selectUsers.do"
> > > >
> > > > --Caroline
> > > >
> > > >
> > > > --- Ed Griebel <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > The reason is that your checkbox really is
> no
> > > longer
> > > > > in the form, so
> > > > > the framework doesn't know where to pull the
> > > value
> > > > > from. All of the
> > > > > <html> and <html-el> tags which create form
> > > > > 'widgets' must be between
> > > > > <html:form> and </html:form>.
> > > > >
> > > > > What you probably need to do is to create a
> > > second
> > > > > form on the page by
> > > > > adding <html:form
> > > action="/admin/selectUsers.do">
> > > > > before the
> > > > > <c:forEach> and change the <html:link> to
> > > > > <html:submit> followed by
> > > > > </html:form>
> > > > >
> > > > > HTH,
> > > > > -ed
> > > > >
> > > > > On 6/29/06, Caroline Jen
> <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > My <html-el:checkbox ....> worked fine. 
> But
> > > if
> > > > > the
> > > > > > <html-el:form ....> ... </html-el:form>
> come
> > > > > before
> > > > > > the <html-el:checkbox ... >, I got the
> runtime
> > > JSP
> > > > > > error: "cannot find bean:
> > > > > > "org.apache.struts.taglib.html.BEAN" in
> any
> > > > > scope".
> > > > > >
> > > > > > The complaint points specifically to the
> > > > > > <html-el:checkbox
> > > > > >
> > > property="selectedUsers[${idx.index}].selected"
> > > > > />.
> > > > > > The getter method for
> > > selectedUsers[0].selected
> > > > > can no
> > > > > > longer be recognized.
> > > > > >
> > > > > > I need help because I really do not
> understand
> > > why
> > > > > it
> > > > > > happens this way.
> > > > > >
> > > > > > [code].....
> > > > > > <%@ page
> import="......common.pojo.user.User"
> > > %>
> > > > > > ......
> > > > > > ......
> > > > > > <!-- Create a variable in scope called
> > > userRows
> > > > > from
> > > > > > the Users object -->
> > > > > > <c:set var="userRows"
> > > > > value="${requestScope.Users}" />
> > > > > > <c:choose>
> > > > > >
> > > > > >                                
> <html-el:form
> > > > > > action="/admin/findUsers.do">
> > > > > >                                           
> //
> > > many
> > > > > > textfields and a submit button
> > > > > >
> > > </html-el:form>
> > > > > >
> > > > > >         <c:when test="${not empty
> userRows}">
> > > > > > ......
> > > > > > ......
> > > > > >                      <!-- create a "user"
> > > object
> > > > > for
> > > > > > each element in the userRows -->
> > > > > >             <c:forEach var="user"
> > > > > items="${userRows}"
> > > > > > varStatus="idx">
> > > > > >                                 <tr>
> > > > >                                      <td
> > > > > > align="center">
> > > > > >                 <html-el:checkbox
> > > > > >
> > > property="selectedUsers[${idx.index}].selected"
> />
> > > > > >                 <html-el:hidden
> > > > > > property="selectedUsers[${idx.index}].id"
> > > > > > value="${user.id}"/>
> > > > > >                 </td>
> > > > > >                                 </tr>
> > > > > > ......
> > > > > > ......
> > > > > >            </c:forEach>
> > > > > >                    <tr>
> > > > > >                 <td colspan="6"
> align="left">
> > > > > >                 <html-el:link
> > > > > action="/admin/selectUsers.do">Edit
> > > > > > Selected Users</html-el:link>
> > > > > >                 </td>
> > > > > >                    </tr>
> > > > > >         </c:when>
> > > > > > ......
> > > > > > </c:choose>
> > > > > > ......
> > > > > > ......
> > > > > > [/code]
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > >
> __________________________________________________
> > > > > > Do You Yahoo!?
> > > > > > Tired of spam?  Yahoo! Mail has the best
> spam
> > > > > protection around
> > > > > > http://mail.yahoo.com
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail:
> > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
package gov.cbp.ace.st.tf.web.admin.form;

import java.sql.Timestamp;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;


public class SelectUsersForm extends ActionForm
{
        private Map selectedUserFieldMap = new HashMap();
        private String[] selectedUsers = new String[0];
        private String[] selectedUserIDs;


    public SelectedUserField getSelectedUsers( int index )
    {
       SelectedUserField selectedUserField = ( SelectedUserField 
)selectedUserFieldMap.get( new Integer( index ) );
       if ( selectedUserField == null )
       {
         selectedUserField = new SelectedUserField();
         selectedUserFieldMap.put( new Integer( index ), selectedUserField );
       }
       return selectedUserField;
    }

    // Convenience method to get a list of selected user IDs.
    public String[] getSelectedUserIDs()
    {
       List theUserIDList = new ArrayList();

       Iterator i = selectedUserFieldMap.values().iterator();
       while( i.hasNext() )
       {
          SelectedUserField selectedUserField = ( SelectedUserField ) i.next();
          if ( selectedUserField.isSelected() )
          {
             theUserIDList.add( selectedUserField.getId() );
          }
       }
       return ( String[] )theUserIDList.toArray( new 
String[theUserIDList.size()] );
   }

   public void reset( ActionMapping mapping, HttpServletRequest request)
   {
       selectedUsers = new String[0];
       selectedUserIDs = new String[0];
   }
}
package gov.cbp.ace.st.tf.web.admin.form;

import java.sql.Timestamp;

public class SelectedUserField
{
    private boolean selected = false;
    private Long id;
    
    public Long getId()
    {
       return id;
    }

    public void setId( Long newValue )
    {
       id = newValue;
    }

    public boolean isSelected()
    {
       return selected;
    }

    public void setSelected( boolean newValue )
    {
       selected = newValue;
    }
}

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

Reply via email to