aspose file tools*
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
Author

Help needed for Struts2 iterator

Alex Winner
Greenhorn

Joined: Jun 01, 2011
Posts: 5
I have a class Bid:
public class Bid implements Serializable {
...
@ManyToOne
@JoinColumn(name="ACCOUNT_ID")
private Account account;

@Column(name="BID_PRICE")
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">
<tr>
<td>
<s:property value="account"/>
</td>
<td>
<s:property value="account.loginId"/>
</td>
<td>
<s:property value="%{account.loginId}"/>
</td>
<td>
<s:property value="%{#account.loginId}"/>
</td>
<td>
<s:property value="bidPrice"/>
</td>
</tr>
</s:iterator>

Any idea?
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


Hello,

What is being displayed by:



Cheers,
Raj.
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
Greenhorn

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....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help needed for Struts2 iterator