Results 1 to 2 of 2
  1. #1
    piterskiy74 is offline Member
    Join Date
    Dec 2007
    Rep Power

    Cool How to use a drop-down box in Struts

    If anyone can help me how to show the List values in a drop-down box, that would be greate.

    I have created a List in Action class and put it into request

    ArrayList list = new ArrayList();

    request.setAttribute("exsList", list);

    And in JSP I have following:

    <bean:define id="aList" name = "exsList" />

    I just want to display these numbers in drop-down. What should I do next. Thank you

  2. #2
    Poonam is offline Member
    Join Date
    Nov 2007
    Rep Power


    Hi ,
    on jsp use this code

    <html:select property="contact" >
    <html: optionsCollection property="listOfContact" >

    Now in ActionForm (bean which form is using)write setter and getter for String "contact" and List "listOfContact".

    after in constuctor of ActionForm write logic=

    public constuctorName() {
    listOfContact=new ArrayList();
    listOfContact.add(new LabelValueBean("1","Printing media"));
    listOfContact.add(new LabelValueBean("2","Radio"));
    listOfContact.add(new LabelValueBean("3","T.V."));


    u have to import package:

    import org.apache.struts.util.LabelValueBean;

    when u run jsp list will come on page.;)
    Last edited by Poonam; 02-13-2008 at 12:44 PM.

Similar Threads

  1. Drop down menu
    By BenNeiderlander in forum New To Java
    Replies: 3
    Last Post: 02-05-2008, 08:35 AM
  2. Drag and drop
    By abhivenugopal in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 01-30-2008, 03:10 PM
  3. help drag and drop in JTabbedPane
    By RO86 in forum AWT / Swing
    Replies: 0
    Last Post: 08-14-2007, 02:22 PM
  4. drop down box details info
    By eeau1973 in forum New To Java
    Replies: 0
    Last Post: 08-11-2007, 10:04 PM
  5. Replies: 3
    Last Post: 06-07-2007, 06:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts