File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Help needed for Struts2 iterator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help needed for Struts2 iterator" Watch "Help needed for Struts2 iterator" New topic

Help needed for Struts2 iterator

Alex Winner

Joined: Jun 01, 2011
Posts: 5
I have a class Bid:
public class Bid implements Serializable {
private Account account;

private BigDecimal bidPrice;

in my action class ListingAction:
public class ListingAction extends ActionSupport {
private List<Bid> bids = null;
public String getBids() throws Exception {

I run getBids and in debug mode, I can see all bids information returned include the "Account" information and loginId. but the JSP show the nothing for loginId (first 4 cell), but bidPrice is showing up correctly.
<s:iterator value="bids">
<s:property value="account"/>
<s:property value="account.loginId"/>
<s:property value="%{account.loginId}"/>
<s:property value="%{#account.loginId}"/>
<s:property value="bidPrice"/>

Any idea?
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 445


What is being displayed by:

Sunil Sunny
Ranch Hand

Joined: Oct 18, 2011
Posts: 41
first check while using <s:property value="account"/> if you get some value like "org.hibernate@878234" etc then means its some typing mistake otherwise there will be mapping error..................
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Try like this <s:property value="loginId"/>

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Tomasz Sobal

Joined: Oct 25, 2011
Posts: 3
From my short experience as as struts2 newbie :-) first thing to do is check spelling and existence of getters. I offen tend to search for some sneaky little bugs of struts but it usually ends up with finding that I just made an obvious mistake....
I agree. Here's the link:
subject: Help needed for Struts2 iterator
It's not a secret anymore!