struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juanjo Cuadrado" <jjcuadr...@gmail.com>
Subject Re: Two drop downs, and I need that the contents of the second dependent on the value selected in the first!!!
Date Tue, 19 Sep 2006 07:24:04 GMT
Hi,

   I don't know if I have you understands, but I think that this mail of
Eric Givler responds to your question....

You'd need to rebuild the second list on the posting of the form, i.e.
1. get value selected from first list
2. invoke method to refresh dependent list based on user prm from fist list
3. place that list into a request attribute to read on the page.

Here's a code snippet.  The prepareLOVs is called on a post-back event:

public void prepareLOVs(ActionForm form,
                       HttpServletRequest request)
     throws Exception
{
  MyForm myform = (MyForm) form;
  String strCountyId = myform.getCounty_id();
  AppModule am = new AppModuleImpl( request.getRemoteUser() );
  List municipalities = am.getPaMunicipalitiesView( strCountyId );
  request.setAttribute ( Constants.MUNICIPALITIES_LOV , municipalities );



2006/9/19, yamilka vallejo ramos <yamilka84@gmail.com>:
>
> 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!!
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message