struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maturo, Larry" <larry_mat...@AthensGroup.com>
Subject RE: Multiple Selects in a JSP
Date Mon, 01 Apr 2002 16:37:43 GMT
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
   lmaturo@athensgroup.com


-----Original Message-----
From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
Sent: Friday, March 29, 2002 2:55 PM
To: struts-user@jakarta.apache.org
Subject: Re: Multiple Selects in a JSP


Subject: Re: Multiple Selects in a JSP
From: "Ken Holzer" <kholzer@bhroyce.com>
 ===
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" <larry_maturo@AthensGroup.com> wrote in message
news:mailman.1017343560.7408.struts@basebeans.com...
> 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:@Basebeans.comstruts@basebeans.com]
> Sent: Thursday, March 28, 2002 12:55 PM
> To: struts-user@jakarta.apache.org
> Subject: Re: Multiple Selects in a JSP
>
>
> Subject: Re: Multiple Selects in a JSP
> From: "Ken Holzer" <kholzer@bhroyce.com>
>  ===
> 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" <larry_maturo@AthensGroup.com> wrote in message
> news:mailman.1017183480.26376.struts@basebeans.com...
> > 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
> >    lmaturo@athensgroup.com
> >
> > -----Original Message-----
> > From: Struts Newsgroup [mailto:@Basebeans.comstruts@basebeans.com]
> > Sent: Tuesday, March 26, 2002 4:25 PM
> > To: struts-user@jakarta.apache.org
> > Subject: Multiple Selects in a JSP
> >
> >
> > Subject: Multiple Selects in a JSP
> > From: "Ken Holzer" <kholzer@bhroyce.com>
> >  ===
> > 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:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>



--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message