You may want to use an struts mailing list archive search, and look at this 
thread:

how to handle requests submitted using java script with a LookupDispatchAction 
subcalss
http://article.gmane.org/gmane.comp.jakarta.struts.user/124351/match=lookupdispatchaction+subcalss+javascript

Or a similar thread here:
JavaScript problem vs. LookupDispatchAction
http://thread.gmane.org/gmane.comp.jakarta.struts.user/14614/focus=14720


Essentially, you need to have the VALUE for the parameter defined in 
struts-config.xml for the LookupDispatchAction set when the user clicks on the 
select list element, for example this selection list uses "refreshlist()" in 
onchange.  Here, the Organizations, is a property of the form bean:

<html:select property="orgId" onchange='refreshlist()'>
        <bean:define id="Organizations" name="DependentListForm" 
property="orgList" 
                     type="java.util.Collection"/>        
        <html:options collection="Organizations" property="value"
                      labelProperty="longName"/>
</html:select>

The refreshlist would be something like this:

<SCRIPT language="JavaScript" type="text/javascript">
function refreshlist() {
          document.forms[0].method.value="refresh";
          document.forms[0].submit();
}
</SCRIPT>

Your action class could then have this:
    
   protected Map getKeyMethodMap() {
      // return Collections.EMPTY_MAP;
      Map map = new HashMap();
      map.put( "dependentlist.refresh", "refreshList");
      map.put( "dependentlist.submit", "submit" );
      return map;
   }

Your resource file would need the message for "refresh" to map to the 
dependentlist.refresh:

dependentlist.refresh=refresh

Your action would need to update the list.  I'm not recommending that the list 
be a property of the form, just saying that the dependentlist, whereever it 
might be, must be updated:

   public ActionForward refreshList(ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response )
     throws Exception 
   {
      System.out.println("-----refreshList()");
      
      DependentListForm dependency_form = (DependentListForm) form;
      // NOTE: I put this in the form for testing...
      dependency_form.refreshStaffList();
      return mapping.getInputForward();
   } // refreshList


-----Original Message-----
From: yamilka vallejo ramos [mailto:[EMAIL PROTECTED]
Sent: Monday, September 18, 2006 6:59 PM
To: user@struts.apache.org
Subject: Two drop downs, and I need that the contents of the second
dependent on the value selected in the first!!!


Hii everyone,
 I  have  two drop downs in my jsp page, and I need to the contents of the
second dependent on the value selected in the first.
To handle this, I need for the first combo box to do a submit when it
changes, so that I have a chance to update the second. But I don't know in
which part of the Action I most write the code to make update the second
drop down, because I'm working with LooKup Dispach Action , and the Hash Map
wait a parameter that I don't have because I did't make submit to any
button, and there's where I set who it's that parameter

example: for me did't work:

<html:select property="orgId" onchange='document.forms[0].submit()'>
    <html:options collection="orgList" property="value"
labelProperty="longName"/>
</html:select>

because I don't know in which part of the Action I most write the code to
make update the second drop down, because the ActionClass say that it's
waiting a parameter!!

please if somebody know how to do that I will presure!!
thanks!!

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

Reply via email to