wood burning stoves 2.0*
The moose likes Struts and the fly likes How to get an inner property using tags? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to get an inner property using tags?" Watch "How to get an inner property using tags?" New topic
Author

How to get an inner property using tags?

Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
Hi all-

I'm trying to get a nested value from a bean: (I want the count of items)

in my JSP:
<nested:nest name="feeManagementForm" property="feeFormBeans">
<nested:write property="itemCount" />
</nested:nest>

the error I get is:

No getter method for property feeFormBeans.itemCount of bean feeManagementForm

(in my Bean 'feemanagementForm'

public List getFeeFormBeans() {
return feeFormBeans;
}

it's a List--why can't I access properties of List?
because it's not a String?

thanks!
Max
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can access individual items in a list using the <logic:iterate> or <nested:iterate> tags. Check the documentation for how to use them. If you just want to display the number of items, put the following code in your form bean:


Then simply code:

<bean:write name="feeManagementForm" property="itemCount" />

in your jsp.
[ July 14, 2005: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Max Tomlinson
Ranch Hand

Joined: Jul 17, 2001
Posts: 365
thanks Merrill
I was aware that I could simply add methods to my form bean -- I was hoping there was a more dynamic way to get these kind of values.
But I've wasted enough time on it.
thanks for the quick reply.
Max
 
GeeCON Prague 2014
 
subject: How to get an inner property using tags?