Retrieve you states when the application starts up. Either init Servlet or
ServletContextListener.
Place collection of states in ServletContext where they will be available to
all users for the life time of the application.

Use <logic:iterate .../> to render the states.



robert

> -----Original Message-----
> From: Smith, Johnathan M. [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 8:13 AM
> To: 'Struts Users Mailing List'
> Subject: Need Help Fast
>
>
> This is not really a struts question but I am using struts a maybe someone
> can help.  I system has allot of state dropdown's so I I made a
> tag for the
> programmers to insert into the JSP pages.
>
> The Tag builds a ArrayList with the states in it and then saves the states
> as a attribute in the pageContext. But I don't know if this is
> the best way
> to do it.  Is it anyway to tell this code only to run one time
> and then stay
> in member?
>
> Below is my sample code: Please help me out
>
> public int doStartTag() throws JspException {
>
>               java.util.ArrayList states = new java.util.ArrayList();
>               states.add(new com.ubspw.cdd.common.LabelValueBean("-Select
> One-", ""));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("AK",
> "AK"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("AL",
> "AL"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("AR",
> "AR"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("AZ",
> "AZ"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("CA",
> "CA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("CO",
> "CO"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("CT",
> "CT"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("DC",
> "DC"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("DE",
> "DE"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("FL",
> "FL"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("GA",
> "GA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("HI",
> "HI"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("IA",
> "IA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("ID",
> "ID"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("IL",
> "IL"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("IN",
> "IN"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("KS",
> "KS"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("KY",
> "KY"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("LA",
> "LA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MA",
> "MA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MD",
> "MD"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("ME",
> "ME"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MI",
> "MI"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MN",
> "MN"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MO",
> "MO"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MS",
> "MS"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("MT",
> "MT"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NC",
> "NC"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("ND",
> "ND"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NE",
> "NE"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NH",
> "NH"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NJ",
> "NJ"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NM",
> "NM"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NV",
> "NV"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("NY",
> "NY"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("OH",
> "OH"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("OK",
> "OK"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("OR",
> "OR"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("PA",
> "PA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("PR",
> "PR"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("RI",
> "RI"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("SC",
> "SC"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("SD",
> "SD"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("TN",
> "TN"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("TX",
> "TX"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("UT",
> "UT"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("VA",
> "VA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("VI",
> "VI"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("VT",
> "VT"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("WA",
> "WA"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("WI",
> "WI"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("WV",
> "WV"));
>               states.add(new com.ubspw.cdd.common.LabelValueBean("WY",
> "WY"));
>               pageContext.setAttribute("selectStates", states);
>               return (EVAL_BODY_INCLUDE);
>
>       }
>
>
> --
> 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