You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by vi...@accenture.com on 2009/03/04 10:21:40 UTC
Retrieving the values from list
Hi,
I am setting the values retrieved from DB into a list
"sessionListDefects" in my Action class as shown below:
try
{
DefectDelegate defectDelegate = new DefectDelegate();
sessionListDefects = defectDelegate.findDefect();
for (Iterator iterator = sessionListDefects.iterator();
iterator.hasNext();) {
DefectDTO defectDTO = (DefectDTO) iterator.next();
System.out.println("defectDTO.getDefectNo :
"+defectDTO.getDefectNo());
System.out.println("defectDTO.getProject :
"+defectDTO.getProject());
}
session.put(WebConstants.SESSION_LIST_DEFECTS,
sessionListDefects);
}
But I am not able to print the values from the list using the
iterator in JSP:
<s:iterator id="sessionListDefects" value="#session['sessionListDefects']">
<tr>
<td><s:property value="defectNo"/></td>
<td><s:property value="project"/></td>
</tr>
</s:iterator>
Please let me know the right syntax.
Best Regards,
Vikram
Re: Retrieving the values from list
Posted by Dave Newton <ne...@yahoo.com>.
Martin Gainty wrote:
> also as Patrick points out in his comment on Iteration Tags, the '[n]' notation refers to a sub-stack beginning at position n
> http://struts.apache.org/2.0.14/docs/iterator-tag-examples.html
> your reference to fu[bar]
> tries to resolve bar to a number and display what is located at stack position fu[barIntegerValue]
Unless fu is a collection or map. [n] only refers to (stack-n entries)
when it stands on its own.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Retrieving the values from list
Posted by Martin Gainty <mg...@hotmail.com>.
Not understanding why you would not to display #session.sessionListDefects
http://struts.apache.org/2.0.14/docs/accessing-application-session-request-objects.html
also as Patrick points out in his comment on Iteration Tags, the '[n]' notation refers to a sub-stack beginning at position n
http://struts.apache.org/2.0.14/docs/iterator-tag-examples.html
your reference to fu[bar]
tries to resolve bar to a number and display what is located at stack position fu[barIntegerValue]
does your ActionForm implement SessionAware interface as earlier suggested
implements SessionAware
?
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
Subject: Retrieving the values from list
Date: Wed, 4 Mar 2009 14:51:40 +0530
From: vikram.g.byali@accenture.com
To: user@struts.apache.org
Hi,
I am setting the
values retrieved from DB into a list “sessionListDefects” in my Action class as shown below:
try
{
DefectDelegate defectDelegate = new DefectDelegate();
sessionListDefects =
defectDelegate.findDefect();
for (Iterator iterator = sessionListDefects.iterator();
iterator.hasNext();) {
DefectDTO defectDTO = (DefectDTO)
iterator.next();
System.out.println("defectDTO.getDefectNo : "+defectDTO.getDefectNo());
System.out.println("defectDTO.getProject : "+defectDTO.getProject());
}
session.put(WebConstants.SESSION_LIST_DEFECTS, sessionListDefects);
}
But
I am not able to print the values from the list using the iterator in JSP:
<s:iterator
id="sessionListDefects"
value="#session['sessionListDefects']">
<tr>
<td><s:property
value="defectNo"/></td>
<td><s:property
value="project"/></td>
</tr>
</s:iterator>
Please let me know the right syntax.
Best Regards,
Vikram
_________________________________________________________________
Windows Live™ Groups: Create an online spot for your favorite groups to meet.
http://windowslive.com/online/groups?ocid=TXT_TAGLM_WL_groups_032009