p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Struts (http://p2p.wrox.com/struts-211/)
-   -   Looping through a list using logic tags problem (http://p2p.wrox.com/struts/40373-looping-through-list-using-logic-tags-problem.html)

aadz5 March 25th, 2006 06:42 PM

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">
        <td>Hello baby!</td>

Can someone please help.


Adz - Its all about the JSPs baby!

aadz5 March 26th, 2006 09:15 AM

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" />

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


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


I get this error:


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?


Adz - Its all about the JSPs baby!

aadz5 April 4th, 2006 05:08 PM

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!

suryanarayanjena3 September 23rd, 2011 03:18 AM

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

All times are GMT -4. The time now is 03:20 PM.

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