Hi Thanx for the reply Brandon, i was able to get it working after converting the Hashtable to ArrayList having LabelValueBean like this Hashtable ht = mapsContextData.getAS400List(oCtx); Enumeration enu = ht.keys(); ArrayList data = new ArrayList(); while(enu.hasMoreElements()) { String key = (String)enu.nextElement(); String value = (String)ht.get(key); logger.debug("key is " + key + " value " + value); data.add(new LabelValueBean(value, key)); } But really hoped to be able to use Hashtable rather then adding this code
Ashish --- Brandon Mercer <[EMAIL PROTECTED]> wrote: > Ashish Kulkarni wrote: > > >Hi > >How do i display a drop down box from hashtable > data > >here is my form definiation > ><form-bean dynamic="true" name="loginForm" > >type="org.apache.struts.validator.DynaValidatorForm"> > ><form-property name="as400list" > >type="java.util.Hashtable" /> > ></form-bean> > > > >in my html i define > ><html:form action="/login" focus="userId" > >method="post" style="margin:0px;" > > >// logic to display html:select with html:option > tag > ></html:form> > > > > > Yes, totally possible. Here are some snippets. :-) > This is what you'd have in your JSP > <html:select property="propertyname" > size="1"> > <html:options collection="beanname" > property="value" > labelProperty="label"/> > </html:select><br> > > And this is how I build the list in my classes: > First my Action: > > ArrayList trusts = AssetData.getTrusts( > getDataSource(request,"trustmaster"), > errors); > > if ((assets == null) || (codes == null) || > (trusts == null)) { > errors.add( > ActionErrors.GLOBAL_ERROR, > new > ActionError("error.resultset.null")); > } else { > // Put our results set in a bean in the > session > session.setAttribute("assets", assets); > session.setAttribute("codes", codes); > session.setAttribute("trusts", trusts); > } > > > Now my Data: > public static ArrayList getTrusts( > final DataSource dataSource, > final ActionErrors errors) > throws Exception { > > Connection conn = null; > Statement stmt = null; > ResultSet rs = null; > ArrayList trusts = new ArrayList(); > > try { > conn = dataSource.getConnection(); > stmt = conn.createStatement(); > rs = stmt.executeQuery("select * from > trusts;"); > > // While there are results from our > query > // create the codes bean with the proper > // values from the database. > while (rs.next()) { > trusts.add( > new LabelValueBean( > rs.getString("trust_name"), > rs.getString("code"))); > } > > } finally { > if (rs != null) { > rs.close(); > } > if (stmt != null) { > stmt.close(); > } > if (conn != null) { > conn.close(); > } > > } > return trusts; > } > > Hopefully this helps. > Brandon > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]