Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Struts2 iterator

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The below "issue" is resolved... I'm not sure what the problem was but I had to reboot my laptop and when it restarted the .jsp appeared to display the object values as expected. Is there a possible page cache that was cleared when the computer rebooted?



I am starting to work with Struts2 and am having trouble displaying object values that are contained in an ArrayList. I am populating an ArrayList with PersonInfo objects that are being populated from a database. If I use a simple <s:property /> tag in the .jsp the following is displayed: com.mtc.beans.PersonInfo@577d52d9 which indicated the ArrayList is populated with a PersonInfo object. For the life of me I haven't been able to figure out how to get the object values to display.... such as firstName, lastName.... etc...

PersonInfo Class is very straight forward... getters and setters for the individual attributes.

Action Class

public class ListCustomersAction extends ActionSupport {

private static Logger log = Logger.getLogger(ListCustomersAction.class.getClass());
private List list = new ArrayList();

public List getList() {
return list;
}

public String exectue() throws Exception {
try {
list = new CustomerSRV().listCustomers();
}
catch(Exception e) {
log.error("--- " + this.getClass().getName() +
"--- MESSAGE: " + e.toString());
}
return SUCCESS;
}
}


.jsp

<% taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>MTC</title>
</head>
<body>
<table>
<tr>
<td colspan="2"><jsp:include page="/layout/header.jsp" /></td>
</tr>
<tr>
<td><jsp:include page="/layout/menu.jsp" /></td>
<td>
<s:iterator value="list">
<s:property value="firstName" /><br>
</s:iterator>
</td>
</tr>
<tr>
<td colspan="2"><jsp:include page="/layout/footer.jsp" /></td>
</tr>
</table>
</body>
</html>
 
Forget Steve. Look at this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!