You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RALPH ROPER <RR...@cuscal.com.au> on 2003/06/17 10:21:23 UTC

logic:iterate displaying blanks

hi,

I had a good search on the user group and could not find any answer for this
one. I have a DispatchAction class, called ShowLogsAction that goes away and
returns a list of LogItem items. All the properties on LogItem are public eg
public String auditDate

ShowLogsAction
<snippet>
	System.out.println("Entering ShowLogAction");
		
		ValueListHandler listHandler = new LogListHandler();
		
		DynaActionForm logForm = (DynaActionForm) form;
		
		List logs = listHandler.getNextElements(20);
		ArrayList logList = new ArrayList();
		for(Iterator i = logs.iterator(); i.hasNext();){
			LogItem log = (LogItem) i.next();
			System.out.println("action date=" + log.auditDate);
			logList.add(log);
		}
			
		
		logForm.set("logList", logList);
</snippet>

I have iterated through the Collection again in the action just to make sure
the values are being returned. Everything looks OK to this point.

In my jsp, showLogs.jsp, I then iterate over the Collection and print the
date and and userNaem properties of the LogItem in the Collection. This is
done as so.

showLogs.jsp
<snippet>

<% String forward = "/showLogs"; %>
<html:form action="<%= forward %>" >
   
	<TABLE border="1">
		<TBODY>
		
		<logic:iterate id="logs" name="logsForm" property="logList"
scope="request" 
			type="com.cuscal.payments.bpay.enquiry.LogItem">
			<TR>
				<TD>auditDate= <bean:write name="logs"
property="auditDate" /> </TD>
				<TD>user name= <bean:write name="logs"
property="userName" /> </TD>
			</TR>
		</logic:iterate>
	</TBODY>
	</TABLE>

</html:form>

</snippet>

While I get 20 rows back they are all blank. This is the result.
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name= 	
auditDate= 	user name=	

Obviously this has caused me hours of amusement. Can anyone think why this
would be producing such a result? All suggestions gratefully appreciated.

Ralph Roper


________________________________________________________
NOTICE
The information in this email and or any of the attachments may contain;
a. Confidential information of Credit Union Services Corporation (Australia) Limited (CUSCAL) or third parties; and or
b. Legally privileged information of CUSCAL or third parties; and or
c. Copyright material of CUSCAL or third parties.
If you are not an authorised recipient of this email, please contact CUSCAL immediately by return email or by telephone on 61-2-8299 9000 and delete the email from your system.
We do not accept any liability in connection with computer virus, data corruption, interruption or any damage generally as a result of transmission of this email.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: logic:iterate displaying blanks

Posted by Sandeep Takhar <sa...@yahoo.com>.
I think you want to do a 

html:form action="/showLogs.do" ?

also, check to see what your html source is for this
form line and verify that it is using the "name"
element from your struts-config.

sandeep
--- RALPH ROPER <RR...@cuscal.com.au> wrote:
> hi,
> 
> I had a good search on the user group and could not
> find any answer for this
> one. I have a DispatchAction class, called
> ShowLogsAction that goes away and
> returns a list of LogItem items. All the properties
> on LogItem are public eg
> public String auditDate
> 
> ShowLogsAction
> <snippet>
> 	System.out.println("Entering ShowLogAction");
> 		
> 		ValueListHandler listHandler = new
> LogListHandler();
> 		
> 		DynaActionForm logForm = (DynaActionForm) form;
> 		
> 		List logs = listHandler.getNextElements(20);
> 		ArrayList logList = new ArrayList();
> 		for(Iterator i = logs.iterator(); i.hasNext();){
> 			LogItem log = (LogItem) i.next();
> 			System.out.println("action date=" +
> log.auditDate);
> 			logList.add(log);
> 		}
> 			
> 		
> 		logForm.set("logList", logList);
> </snippet>
> 
> I have iterated through the Collection again in the
> action just to make sure
> the values are being returned. Everything looks OK
> to this point.
> 
> In my jsp, showLogs.jsp, I then iterate over the
> Collection and print the
> date and and userNaem properties of the LogItem in
> the Collection. This is
> done as so.
> 
> showLogs.jsp
> <snippet>
> 
> <% String forward = "/showLogs"; %>
> <html:form action="<%= forward %>" >
>    
> 	<TABLE border="1">
> 		<TBODY>
> 		
> 		<logic:iterate id="logs" name="logsForm"
> property="logList"
> scope="request" 
> 			type="com.cuscal.payments.bpay.enquiry.LogItem">
> 			<TR>
> 				<TD>auditDate= <bean:write name="logs"
> property="auditDate" /> </TD>
> 				<TD>user name= <bean:write name="logs"
> property="userName" /> </TD>
> 			</TR>
> 		</logic:iterate>
> 	</TBODY>
> 	</TABLE>
> 
> </html:form>
> 
> </snippet>
> 
> While I get 20 rows back they are all blank. This is
> the result.
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name= 	
> auditDate= 	user name=	
> 
> Obviously this has caused me hours of amusement. Can
> anyone think why this
> would be producing such a result? All suggestions
> gratefully appreciated.
> 
> Ralph Roper
> 
> 
>
________________________________________________________
> NOTICE
> The information in this email and or any of the
> attachments may contain;
> a. Confidential information of Credit Union Services
> Corporation (Australia) Limited (CUSCAL) or third
> parties; and or
> b. Legally privileged information of CUSCAL or third
> parties; and or
> c. Copyright material of CUSCAL or third parties.
> If you are not an authorised recipient of this
> email, please contact CUSCAL immediately by return
> email or by telephone on 61-2-8299 9000 and delete
> the email from your system.
> We do not accept any liability in connection with
> computer virus, data corruption, interruption or any
> damage generally as a result of transmission of this
> email.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org