javax.servlet.ServletContextListener @since Servlet2.2 spec acts a
bootstrap.
Prior to Servlet2.2 spec, try a bootstrap  servlet.

A quick scan of the mailing list archives and .....
http://www.mail-archive.com/[email protected]/msg38242.html

should help.

robert


> -----Original Message-----
> From: Day, Michael-IBM/TT [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 9:17 AM
> To: Struts Users Mailing List
> Subject: RE: AAAARGH! SOMEONE! How do I set the default selection when
> I'm using html:options?
>
>
> This is probably one of the stupidest questions, but I don't know
> how to do something once during application startup.
>
> For instance, if I wanted a bean to hold a list of states, how
> would I create that once during startup?
>
> -----Original Message-----
> From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 8:00 AM
> To: Struts Users Mailing List
> Subject: Re: AAAARGH! SOMEONE! How do I set the default selection when
> I'm using html:options?
>
>
> One more advice to make your life easier: Why bother getting the states
> from the database for every form ( or even the same form ) when it's
> accessed ? I think the better way is to load the states when the app
> starts up and store it in the application bean in format that you can
> get the list very easy way, by getting it from the application bean on
> the form, like this :
>
>                 <html:select property="state">
>                 <logic:present name="abean" scope="application">
>                 <html:option key="text.choosestate" value=""/>
>                 <html:options name="abean" property="statesarraykeys"
> labelName="abean" labelProperty="statesarrayvalues"/>
>                 </logic:present>
>             </html:select>
>
> both "statesarraykeys" and "statesarrayvalues" in the application bean
> are "ArrayList"(s).
>
> Let's face it, how often a list of US states changes ? Once in 500 years
> ? :)
>
> Jf
>
>
> Galbreath, Mark wrote:
>
> >In your Action class, call a data access object to get a
> ResultSet from your
> >database containing all the states and pass them as a List.
> >
> >Action class:
> >myDAO dao = new myDAO();
> >dao.getStates();
> >
> >
> >DAO:
> >public List getStates() throws SQLException {
> >  List states = new ArrayList();
> >
> >  while( rs.next()) {
> >    states.add( rs.getString( "[name of db column containing states]");
> >  }
> >  return states;
> >}
> >
> >Action class:
> >MyActionForm actionForm = (MyActionForm) form;
> >form.setStates( states);
> >
> >ActionForm class:
> >private List states = null;
> >public void setStates( List states){
> >  this.states = states;
> >}
> >public List getStates(){
> >  return states;
> >}
> >
> >JSP:
> ><html:select property="usStates">
> >  <html:option value="0">Select A State</html:option>
> >  <html:options name="MyActionForm.getStates()" />
> ></html:select>
> >
> >Mark
> >
> >-----Original Message-----
> >From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, September 18, 2002 2:22 PM
> >To: Struts Users Mailing List
> >Subject: Re: AAAARGH! SOMEONE! How do I set the default selection when
> >I'm using html:options?
> >
> >
> >Can you post some code : what are the values of the states, what is the
> >definitions in the form, how you're setting the default value , etc.
> >
> >Jf
> >
> >Michael Lee wrote:
> >
> >
> >
> >>Thanks, but nada.
> >>The ActionForm state is set yet its still not working. :(
> >>Is the problem with the options?
> >><html:select property="state" size="1">
> >>   <html:options name="allUnitedStates" labelName="allUnitedStates"/>
> >> </html:select>
> >>
> >>----- Original Message -----
> >>From: "Hoang, Hai" <[EMAIL PROTECTED]>
> >>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >>Sent: Wednesday, September 18, 2002 11:31 AM
> >>Subject: RE: How do I set the default selection when I'm using
> >>
> >>
> >html:options?
> >
> >
> >>
> >>
> >>
> >>
> >>>You need to populate the value of the property of the dropdown
> before the
> >>>jsp is render...the best way to do this is in the action class.
> >>>
> >>>For example, you have getter and setter for State in the form
> bean...now
> >>>
> >>>
> >>>
> >>>
> >>you
> >>
> >>
> >>
> >>
> >>>need to setState("TX") in the action class if you want to have
> Texas as a
> >>>default state.
> >>>
> >>>-----Original Message-----
> >>>From: [EMAIL PROTECTED]
> >>>[mailto:[EMAIL PROTECTED]]
> >>>Sent: Wednesday, September 18, 2002 10:28 AM
> >>>To: [EMAIL PROTECTED]
> >>>Subject: RE: How do I set the default selection when I'm using
> >>>
> >>>
> >>>
> >>>
> >>html:options?
> >>
> >>
> >>
> >>
> >>>You can add in an <html:option> tag above the <html:options> tag that
> >>>will be the default.
> >>>
> >>>
> >>>
> >>>-----Original Message-----
> >>>From: mleejr [mailto:[EMAIL PROTECTED]]
> >>>Sent: Wednesday, September 18, 2002 11:21 AM
> >>>To: struts-user
> >>>Subject: How do I set the default selection when I'm using
> html:options?
> >>>
> >>>
> >>>1) How do I set a default value in an html:select on an options list? I
> >>>need the default state to be the one loaded from the struts form.
> >>>It doesn't like this.
> >>>
> >>><html:select property="state" size="1" value="<%= state in ActionForm
> >>>%>">
> >>>  <html:options name="allUnitedStates" labelName="allUnitedStates"/>
> >>></html:select>
> >>>
> >>>thanks everyone,
> >>>Mike
> >>>
> >>>
> >>>--
> >>>To unsubscribe, e-mail:
> >>><mailto:[EMAIL PROTECTED]>
> >>>For additional commands, e-mail:
> >>><mailto:[EMAIL PROTECTED]>
> >>>
> >>>
> >>>_______________________________________________________________
> __________
> >>>Introducing the all new and improved continental.com.  With a
> totally new
> >>>personalized design, it's the best place to go. Before you go.
> >>>
> >>>Continental Airlines. Work Hard. Fly Right.
> >>>
> >>>http://www.continental.com
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>--
> >>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