Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 25th, 2006, 07:42 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Portsmouth, Hampshire, United Kingdom.
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.
Reply With Quote
  #2 (permalink)  
Old March 26th, 2006, 10:15 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Portsmouth, Hampshire, United Kingdom.
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!
Reply With Quote
  #3 (permalink)  
Old April 4th, 2006, 06:08 PM
Friend of Wrox
 
Join Date: Oct 2003
Location: Portsmouth, Hampshire, United Kingdom.
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!
Reply With Quote
  #4 (permalink)  
Old September 23rd, 2011, 04:18 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07: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 08:11 AM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 07:19 PM



All times are GMT -4. The time now is 02:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.