Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

bean:define to define an array of Strings

 
Gayatri Sinha
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic