• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Help needed for Struts2 iterator

 
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?
 
Ranch Hand
Posts: 451
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello,

What is being displayed by:



Cheers,
Raj.
 
Ranch Hand
Posts: 42
  • 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..................
 
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"/>
 
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....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic