• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help needed for Struts2 iterator

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 479
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hello,

What is being displayed by:



Cheers,
Raj.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..................
 
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try like this <s:property value="loginId"/>
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic