Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Struts drop down

  1. #1
    Junior Member
    Join Date
    Sep 2009
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation Struts drop down

    HI!

    I am working on struts1.2,i want to develop registration form in my appln,
    In my screen,I have country drop down box and state drop down box,the country values i need to get it from
    database and display on jsp screen,

    I dn't want to use sql query tag to execute query in jsp,how to display in other way the country drop down?..

    Thanks,

    Kalees.


  2. #2
    Junior Member
    Join Date
    Jan 2010
    Posts
    6
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Struts drop down

    In your Action class, instantiate a dao class which has a method that returns an ArrayList of LabelValueBean (look at api) of value='value of dropdown' and label='label of dropdown' and place the ArrayList of LabelValueBean into you session attribute.

    In your jsp, use <html:select> and <htmlptions> tag. In <htmlptions> tag, attribute property='value', labelProperty='label' and collections='name of session attribute'

    like this:

    <html:select property="tasks" styleId="tasks" style="width:500px;">
            <html:options collection="[I]name of session attribute[/I]" property="value" labelProperty="label"/>
    </html:select>

Similar Threads

  1. 'MouseUp' Drag and Drop Events
    By copeg in forum AWT / Java Swing
    Replies: 0
    Last Post: November 10th, 2009, 07:21 PM
  2. Struts combobox edit
    By kalees in forum Web Frameworks
    Replies: 2
    Last Post: November 1st, 2009, 12:27 AM
  3. Struts 1.3.8 and tiles
    By jsnx7 in forum Web Frameworks
    Replies: 3
    Last Post: July 21st, 2009, 03:29 AM
  4. Website to study Struts framework
    By kirman in forum Java IDEs
    Replies: 2
    Last Post: October 17th, 2008, 07:26 AM