Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-12-2008, 10:02 PM
Member
 
Join Date: Dec 2007
Posts: 2
piterskiy74 is on a distinguished road
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();
list.add("1");
list.add("2");

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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-13-2008, 01:42 PM
Member
 
Join Date: Nov 2007
Posts: 15
Poonam is on a distinguished road
Hi ,
on jsp use this code

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

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 01:44 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop down menu BenNeiderlander New To Java 3 02-05-2008 09:35 AM
Drag and drop abhivenugopal JavaServer Pages (JSP) and JSTL 0 01-30-2008 04:10 PM
help drag and drop in JTabbedPane RO86 AWT / Swing 0 08-14-2007 03:22 PM
drop down box details info eeau1973 New To Java 0 08-11-2007 11:04 PM
Is it possible to disable drop in a component? Ada AWT / Swing 3 06-07-2007 07:52 PM


All times are GMT +3. The time now is 05:27 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org