Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2006, 07:42 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default Looping through a list using logic tags problem

Hiya Guys,

I want to loop through an array list and then display its contents. This is what I have so far:

<logic:iterate id="settings" name="user" property="userSettings">
    <tr>
        <td>Hello baby!</td>
    </tr>
</logic:iterate>

Can someone please help.

Thanks

Adz - Its all about the JSPs baby!
__________________
Adz - Learning The J2EE Ways.
 
Old March 26th, 2006, 10:15 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default

Hiya Guys,

An update to the problem, I now know how to display the value stored in the scripting variable however I wish to do display text fields dynamically with the property value of the string values in the collection. My code is as follows:

<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>

<jsp:useBean id="user" scope="session" class="mnaAccounting.User" />

<html>
<head>
    <title>New Page</title>
    <h1>Test Test Test</h1>
</head>

<body>

<table>
<html:form action="accounting">
    <tr>
        <td><p/>Welcome <bean:write name="user" property="firstName" /> please enter you account details</td>
    </tr>
    <logic:iterate id="settings" name="user" property="userSettings">
    <tr>
        <td><html:text property="<%=(String)settings%>"/></td>
        <td><%=settings%></td>
    </tr>
    </logic:iterate>
    <tr>
        <td><html:submit /></td>
        <td><html:cancel /></td>
    </tr>
</html:form>
</table>

</body>
</html>

I get this error:

exception

javax.servlet.ServletException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
    org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:846)
    org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:779)
    org.apache.jsp.EnterAccounts_jsp._jspService(org.a pache.jsp.EnterAccounts_jsp:157)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:99)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:325)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

What am I doing wrong?

Ads

Adz - Its all about the JSPs baby!
 
Old April 4th, 2006, 05:08 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default

Hi People,

I guess no one knows the answer, the problem was in the mapping of the action with the input page, got it sorted though. I have another problem though which I will raise in a second report.

Anyways people Enjoy the struts!



Adz - Its all about the JSPs baby!
 
Old September 23rd, 2011, 03:18 AM
Registered User
 
Join Date: Sep 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dont wory put ="<%=(String)settings%>" this in ='<%=(String)settings%>'
it will work





Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic display using logic tags rajesh_css Struts 1 December 23rd, 2008 03:42 AM
Login logic problem Gizmo_Gadgethead BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 1st, 2006 06:32 PM
XSLT Looping Logic - Very Urgent ujayaraman XSLT 2 March 3rd, 2005 10:42 AM
Problem with loop logic holdmykidney XSLT 5 July 16th, 2004 07:11 AM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 07:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.