• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help needed for Struts2 iterator

 
Alex Winner
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

What is being displayed by:



Cheers,
Raj.
 
Sunil Sunny
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try like this <s:property value="loginId"/>
 
Tomasz Sobal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic