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 bean:define to define an array of Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:define to define an array of Strings" Watch "bean:define to define an array of Strings" New topic
Author

bean:define to define an array of Strings

Gayatri Sinha
Ranch Hand

Joined: Feb 13, 2006
Posts: 34
HI,

I have a bean that has a list of names
the bean has name="companyNames" property="cName"

In the front end I want to manipulate these names for display purposes and so, want to do so using Java in the jsp page

Can I have this list in a Java string array
something like

<bean efine id="iNames[]" name="companyNames" type="java.lang.String[]" />

so that I can use the iNames[] array
<% System.out.println(iNames[0]); %> in jsp


Is there any way to do this?

I hope I was clear in telling what I wanted..

Thanks,
- Gayatri
Liju Cherian
Ranch Hand

Joined: Mar 17, 2006
Posts: 44
Why don't you use the <logic:iterate> tag to iterate through the list of bean objects, and <bean:write> to display the cName property from the companyNames list.

For example -


Hope this helps.


"What's in a name? That which we call a rose by any other name would smell just as sweet."<br />(William Shakespeare, Romeo and Juliet, Act II, Scene II)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: bean:define to define an array of Strings
 
Similar Threads
Double Iteration
A JSTL doubt while assigning a variable using <c:set/>
displaying data from arrays with html:text
coping an Array from a formbean
logic:iterate usage improvement needed