Return-Path: Delivered-To: apmail-jakarta-struts-user-archive@apache.org Received: (qmail 25359 invoked from network); 22 Jul 2003 14:18:09 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 22 Jul 2003 14:18:09 -0000 Received: (qmail 27866 invoked by uid 97); 22 Jul 2003 14:20:43 -0000 Delivered-To: qmlist-jakarta-archive-struts-user@nagoya.betaversion.org Received: (qmail 27859 invoked from network); 22 Jul 2003 14:20:43 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 22 Jul 2003 14:20:43 -0000 Received: (qmail 21537 invoked by uid 500); 22 Jul 2003 14:17:23 -0000 Mailing-List: contact struts-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list struts-user@jakarta.apache.org Received: (qmail 21513 invoked from network); 22 Jul 2003 14:17:23 -0000 Received: from web11505.mail.yahoo.com (216.136.172.37) by daedalus.apache.org with SMTP; 22 Jul 2003 14:17:23 -0000 Message-ID: <20030722141725.11561.qmail@web11505.mail.yahoo.com> Received: from [171.75.59.80] by web11505.mail.yahoo.com via HTTP; Tue, 22 Jul 2003 07:17:25 PDT Date: Tue, 22 Jul 2003 07:17:25 -0700 (PDT) From: Caroline Jen Subject: RE: drop-down list help To: Struts Users Mailing List In-Reply-To: <20030722133712.27488.qmail@web80603.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi, Rick: Take a look at http://www.reumann.net/do/struts/main In Lesson II, you'll find an example of how to use the html:select tag Lesson II-4 Create ActionForm - The UI element for entering a value into the department field will be a drop-down list. Lesson II-6 Create DepartmentBean - This bean will be used to represent options for the drop-down list. Lesson II-8 Create EmployerService - shows how the list of departments is created. Lesson II-9 Create SetUpEmployerAction - this is where the list of options is put into the session context. code: ---------------------------------------------- Collection departments = service.getDepartments(); HttpSession session = request.getSession(); session.setAttribute( "departments", departments ); ---------------------------------------------- Lesson II-14 Create employeeForm.jsp - shows how the html:select and html:options is used to present a drop-down list of departments. Note the property and labelProperty attributes in the html:options tag: both id and description are properties of the DepartmentBean created in II-6. The collection attribute is the name "departments" which was used when the list of DepartmentBeans was added to the session context (II-9). --- Rick Col wrote: > Hi, Swaroop: > > I have a question about your implementation, do we > still need to implement an actionForm class for the > following drop down list? > > regards, > > > > --- Swaroop George wrote: > > > class="com.xxx.DropdownCollections"> > > > > > > > > > property="months" > > toScope="request"/> > > > > > labelProperty="value"/> > > > > > > > > Hi this is a part of the page I developed.. > > (Ofcourse a commercial > > application..) I have a class called > > DropDownCollections.java > > Now in the class I have a method getMonths() which > > will return me a > > collection of months.. > > > > I am using the months collection to populate the > > options.. > > You can actually use an html:select instead of a > > nested:select > > > > The getMonths() returns a set of beans having two > > attributes key and > > value.. > > Key will be the month numbers 1,2,3,4.. > > While value will be month names Jan, Feb,.. > > While the dropdown is rendered the month name will > > be shown.. When the > > page is submitted the month num(key) will be set > to > > the property 'month' > > > > Hope it helps.. > > Swaroop > > > > -----Original Message----- > > From: Rick Col [mailto:rick_cols@yahoo.com] > > Sent: Tuesday, July 22, 2003 6:24 PM > > To: Struts Users Mailing List > > Subject: drop-down list help > > > > Hi, guys: > > > > I am a struts newbie. I have spent sevaral days > > trying > > build a struts page with several drop-down lists > in > > vain. I am wondering there are any struts drop > down > > lists examples out there. I appreciate your help. > > > > regards, > > > > > > __________________________________ > > Do you Yahoo!? > > SBC Yahoo! DSL - Now only $29.95 per month! > > http://sbc.yahoo.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > struts-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: > > struts-user-help@jakarta.apache.org > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > > struts-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: > > struts-user-help@jakarta.apache.org > > > > > __________________________________ > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! > http://sbc.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > struts-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: > struts-user-help@jakarta.apache.org > __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: struts-user-help@jakarta.apache.org