Hi Ken,

You need to be able to get the initial value of the 
first list in your Action Class, and then you can do
the same thing the first time that you do on updates,
in exactly the same way.  We do this on edits, where
we get the value out of the database.  Always remember
that Struts is two-way.  If you want something to have
an initial value other than the default, then in your
Action class set the field in the form that gets set
when the user puts a value in, in the jsp.

-- Larry Maturo
   [EMAIL PROTECTED]


-----Original Message-----
From: Struts Newsgroup [mailto:@[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 2:55 PM
To: [EMAIL PROTECTED]
Subject: Re: Multiple Selects in a JSP


Subject: Re: Multiple Selects in a JSP
From: "Ken Holzer" <[EMAIL PROTECTED]>
 ===
Thanks Larry,

I was able to get this to work. I do have a related question.

I have a jsp page that shows a history of activities I have the same two
select fields on this jsp. Each row on the page is its own form so that they
can be updated seperately. Is there a way to fill the second select list
based on the value of the first list when the page is populated.

I have gotten it to change when the 1st select is changed, but ai want it to
display correctly when the page is first displayed.

Thanks,

Ken
"Maturo, Larry" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi Ken,
>
> I have a Struts white paper, with an example of this.
> It also has lots of other examples as well.  You can
> get it at: http://stealthis.athensgroup.com/presentations/
> under Model Layer Framework.
>
> Basically you set up both lists in the Action Class and
> put them into the session or request (depends on how you
> set this action up in struts-config.xml).  When the user
> selects an item in the first list it submits the form, and
> in your action you retrieve the variable from the form that
> gets set.  This allows you to redo the second list to match
> the first list, and then you put the new list back into the
> session (or request) and go back to your jsp to redisplay
> the new list.
>
> -- Larry
>
>
> -----Original Message-----
> From: Struts Newsgroup [mailto:@[EMAIL PROTECTED]]
> Sent: Thursday, March 28, 2002 12:55 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Multiple Selects in a JSP
>
>
> Subject: Re: Multiple Selects in a JSP
> From: "Ken Holzer" <[EMAIL PROTECTED]>
>  ===
> Hi Larry,
>
> Do you have a sample app demoing this concept? I am not sure how the
Action
> Form, Action Class and JSP should be setup.
>
> Are the lists built in the Action Form or the Action Class?
>
> Thanks for your help,
>
> Ken
> "Maturo, Larry" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > Hi Ken,
> >
> > Yes, but by using a small amount of JavaScript:
> >
> > <html:select property="orgId" onchange='document.forms[0].submit()'>
> > html:options collection="orgList" property="value"
> > labelProperty="shortName"/>
> > </html:select>
> >
> > You should 0 out the string field orgId in your form bean so that you
> > can tell a selection was made comparing it to 0.
> >
> > -- Larry Maturo
> >    [EMAIL PROTECTED]
> >
> > -----Original Message-----
> > From: Struts Newsgroup [mailto:@[EMAIL PROTECTED]]
> > Sent: Tuesday, March 26, 2002 4:25 PM
> > To: [EMAIL PROTECTED]
> > Subject: Multiple Selects in a JSP
> >
> >
> > Subject: Multiple Selects in a JSP
> > From: "Ken Holzer" <[EMAIL PROTECTED]>
> >  ===
> > I have two selects in my JSP and I want to be able to dynamically change
> the
> > options of the 2nd select based on the choice selected from the 1st
> select.
> >
> > Is there a way to do that using the Struts tags?
> >
> > Thanks,
> >
> > Ken
> >
> >
> >
> > --
> > 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]>
>
>
> --
> 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]>

Reply via email to