Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Struts
Unable to display List values in jsp - Tried all possiblities without success
Nandish Sri
Ranch Hand
Posts: 45
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Result Page where I need to populate all customers:
In this
jsp
, nothing is populating.. please help. Here is my code
customerList.jsp:
<s:iterator value="custInfoVOList" id="user" status="user_stat"> <tr class="<s:if test="#user_stat.odd == true">odd</s:if><s:else>even</s:else>"> <td><s:property value="#user_stat.count" /></td> <td><s:property value="code" /></td> <td><s:property value="name" /></td> <td><s:property value="amount" /></td> <td><s:property value="address" /></td> <td><s:property value="status" /></td> <td><s:property value="comments" /></td> <td><s:property value="contactNbr" /></td> </tr>
My value object:
private String code = null; private String name = null; private String comments = null; private String contactNbr = null; private Double amount = 0.0; private String status = null; private String address = null; private Double totalPaidAmount = 0.0; private String nickName = null; private String contactPerson = null; private Double signalStrength = 0.0; private String amplifier = null; private List<CustInfoVO> custInfoVOList = null; private Set<CardInfo> cardInfoList = new HashSet<CardInfo>(10); private Set<Address> custAddressList = new HashSet<Address>(1); ----------corresponding getter/setter methods------------
business file:
public String execute() throws Exception { logger.debug("inside CustSearch execute method"); CustDAO custDao = new CustDAO(); try { custInfoVOList = custDao.getAllCustomers(); logger.debug("custInfoVOList.size()--->"+custInfoVOList.size()); for (Iterator iterator = custInfoVOList.iterator(); iterator.hasNext();) { CustInfoVO custInfoVO = (CustInfoVO) iterator.next(); logger.debug("custInfoVO.getName()--->"+custInfoVO.getName()); } } catch (Exception e) { addActionMessage("Customer Not Found"); e.printStackTrace(); return "custReports"; } logger.debug("222222222custInfoVOList.size()--->"+custInfoVOList.size()); return "custReports"; }
Log File:
23:33:29,515 DEBUG class:20 - custInfoVOList.size()--->21 23:33:29,531 DEBUG class:23 - custInfoVO.getName()--->SAGAR KBS ---------- .................. ....................... Populating all values 23:33:29,546 DEBUG class:23 - custInfoVO.getName()--->NanduKBSKUI 23:33:29,546 DEBUG class:31 - 222222222custInfoVOList.size()--->21
tiles.xml
<definition name="custReports" extends="baseLayout"> <put-attribute name="title" value="Reports Home"/> <put-attribute name="body" value="/pages/customerList.jsp"/> </definition>
struts.xml
<action name="listUsers" class="kbs.cable.ListCustomers"> <result name="input" type="tiles">/pages/login.jsp</result> <result name="error" type="tiles">/pages/login.jsp</result> <result name="custReports" type="tiles">custReports</result> </action>
Hibernate.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC '-//Hibernate/Hibernate Mapping DTD 3.0//EN' 'http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd'> <hibernate-mapping> <class name="kbs.cable.CustInfoVO" table="cust_info"> <id name="code" type="string" column="code"></id> <property name="name" type="string" column="name" /> <property name="nickName" type="string" column="nickName" /> <property name="amount" type="double" column="amount" /> <property name="contactNbr" type="string" column="contactNbr" /> <property name="address" type="string" column="address" /> <property name="comments" type="string" column="comments" /> <property name="status" type="string" column="status" /> <property name="contactPerson" type="string" column="contactPerson" /> <property name="amplifier" type="string" column="amplifier" /> <property name="signalStrength" type="double" column="signalStrength" /> <set name="custAddressList" cascade="all" inverse="true"> <key column="address_cust_code" not-null="true"/> <one-to-many class="kbs.cable.Address"/> </set> <set name="cardInfoList" cascade="all" inverse="true"> <key column="cust_code" not-null="true"/> <one-to-many class="kbs.cable.CardInfo"/> </set> </class> <class name="kbs.cable.CardInfo" table="collection" > <id column="collection_code" name="collection_code" type="integer"> <generator class="native" /> </id> <property column="cust_code" name="cust_code" type="string" /> <property column="paidDate" name="paidDate" type="date" /> <property column="paidAmount" name="paidAmount" type="double" /> <property column="viewMonth" name="viewMonth" type="string" /> <property column="viewYear" name="viewYear" type="string" /> <property column="paidMonth" name="paidMonth" type="string" /> <property column="paidYear" name="paidYear" type="string" /> </class> <class name="kbs.cable.Address" table="Address" > <id column="address_id" name="address_id" type="integer"> <generator class="native" /> </id> <one-to-one name="cust" class="kbs.cable.CustInfoVO" /> <property column="address_cust_code" name="address_cust_code" type="string" /> <property column="doorNbr" name="doorNbr" type="string" /> <property column="houseName" name="houseName" type="string" /> <property column="cross" name="cross" type="string" /> <property column="main" name="main" type="string" /> <property column="area" name="area" type="string" /> <property column="city" name="city" type="string" /> </class> </hibernate-mapping>
Nandish
David Newton
Author
Posts: 12617
I like...
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Does the action expose
custInfoVOList
?
Nandish Sri
Ranch Hand
Posts: 45
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
After adding getCustInfoVOList method in Action, its working. I was thinking, jsp can take custInfoVOList value from VO itself.
David, Thanks for your solution
Nandish
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Hibernate Issue
Hibernate One-to-many with Set not updating table as expected.. please help
Hibernate - multiple collection with restrictions mapping problem
Struts2 ActionSupport strange issue, without extending it, works fine. please explain the concept
iterate problem in struts2
More...