alrighty,  i've got this half figured out.  i can populate my
dropdowns, but my form doesn't seem to be scrapping the values back
off the page.
i have an action that gets a collection of beans and puts them in
session for the JSP to use.  the JSP renders and displays those
objects correctly in the dropdowns.  when the first dropdown is
changed an onchange event fires off the previous action to populate
the second dropdown.  however, the selected value in the first
dropdown doesn't show up in my Action or the Form.

here's part of the JSP:

<td align="left">
 <html:select name="shoppingListForm" property="selectedShoppingList"
onchange="sl_getGroups(this.form);" >
  <html:option value="-1" >- Please Select A List -</html:option>
  <html:optionsCollection name="lists" />
 </html:select>
 <br>
 <html:select name="shoppingListForm"
property="selectedShoppingListGroup"
onchange="sl_getItems(this.form);" >
  <logic:match name="selectedShoppingList" value="-1">
   <html:option value="-1" >- Please Select A List -</html:option>
  </logic:match>
  <logic:notMatch name="selectedShoppingList" value="-1">
   <html:option value="-1" >- Please Select A Group -</html:option>
   <html:option value="0" >- All Groups -</html:option>
   <html:optionsCollection name="groups" />
  </logic:notMatch>
 </html:select>
</td>

and i have an ActionForm created named shoppingListForm containing two
Strings: selectedShoppingList and selectedShoppingListGroup with
initial values set at "-1".  ShoppingListForm contains basic getters
and setters for these attributes.

so i'm guessing my problem lies within my Action.  i'm extending
DispatchAction and the getGroups method forwards to the above JSP on
"success".

public ActionForward getGroups (

<snip>

try {
    HttpSession session = request.getSession(false);
    ShoppingListForm slForm = (ShoppingListForm)form;
                        
    if (slForm == null) {
        session.setAttribute("selectedShoppingList", "-1");
        session.setAttribute("selectedShoppingListGroup", "-1");
    } else {
        session.setAttribute("selectedShoppingList",
slForm.getSelectedShoppingList());
        session.setAttribute("selectedShoppingListGroup",
slForm.getSelectedShoppingListGroup());
                                
        System.out.println("\n\nShopping List Form...");
        System.out.println("Shopping List: " +
slForm.getSelectedShoppingList());
        System.out.println("Shopping List Group: " +
slForm.getSelectedShoppingListGroup() + "\n\n\n");
    }

... go on to populate collection for lists, etc...

the first time through the form will be null because this action is
called from another page.  the action populates 'lists' and forwards
to the above JSP.  onchange in the JSP calls this same action and
should pass it my ShoppingListForm, in which should be found the value
to selectedShoppingList.  however this value remains "-1".
on success the same JSP is displayed...

here is the action-mapping for this particular action:

<action path="/refresh" 
 parameter="step"
 type="sl.controllers.SLMainAction"
 name="shoppingListForm"
 validate="true">
  <forward name="success" path="/jsp/SLMain.jsp" />
  <forward name="failure" path="/jsp/SLError.jsp" />
</action>

thanks for any help
andy

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

Reply via email to