File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Select in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Select in Struts" Watch "Select in Struts" New topic
Author

Select in Struts

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi All,

I need a select box which displays the values in it. Basically I have a bean called KeyWord which implements Serializable.
The KeyWord bean has methods called

getKeyWords and SetKeyWords

which returns and accepts an ArrayList( it can be a String[] too....depends which one is comfortable).

How do I code this in my Action class and how do i display it on the frontend using input "Select".

Pls provide me an idea how to go abt this ....thx in advance
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
I just figured out how to do this using a struts options tag:


<html:select property="number">
<html ptions collection="numberList" property="description" labelProperty="description"/>
</html:select>


Basically I want to display a list of phone numbers in a select list. So I have a phone numbers bean named "numbers". I also have a bean named "NumberListBean" which has a "public List getList() {" method which returns a collection of numbers.

One last thing I had to do was add the following to the top of my JSP:


<jsp:useBean id="NumberListBean" class="com.mycompany.Beans.NumberListBean" scope="page" />
<bean efine id="numberList" name="NumberListBean" property="list" type="java.util.ArrayList" />
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Select in Struts