You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Softwareentwicklung Hauschel <So...@Hauschel.de> on 2003/01/23 12:46:56 UTC

How to iterate over Arraylist

Hey all,
does anybody knows a nice tutorial about iterating ?
I'm to stupid...


My JSP:

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<jsp:useBean id="person" scope="request"
class="de.hauschel.wapen.bt.vo.VOPerson"/>
<html>
<head>
<title>Struts Form for listpersonsForm</title>
</head>
<body>

<table border="1" width="100%">
  <tr>
    <th align="center" width="30%"> Überschrigft </th>
  </tr>
  <logic:iterate id="person" name="persons" >
  <tr>
    <td align="left"> <bean:write name="person" property="username" />
    </td>
  </tr>
  </logic:iterate>
</table>
</html>

My Action:
public class ListpersonsAction extends WapenAction
{
	public ActionForward execute(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception
	{
		Category cat =
			Category.getInstance(
				"de.hauschel.wapen.struts.action.ListpersonsAction");

		cat.debug("->execute(mapping, form, request, response)");

		ListpersonsForm listpersonsForm = (ListpersonsForm) form;

		ArrayList persons = new ArrayList();

		BusinessDelegate bd = BusinessDelegate.getInstance();
		persons.add( bd.getPerson( "fritz" ) );
		persons.add( bd.getPerson( "fredy" ) );

		cat.debug( "persons.size(): " + persons.size() );

		request.setAttribute( "persons", persons );

		cat.debug("<-execute(mapping, form, request, response)");

		return mapping.findForward( SUCCESS );
	}
}

My Problem:

No usernames listed !


Output of Log4j:
23 Jan 03 12:46:04 DEBUG
de.hauschel.wapen.struts.action.ListpersonsAction.execute
(Line:57) 	 - ->execute(mapping, form, request, response)
23 Jan 03 12:46:04 DEBUG
de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:67) 	 -
persons.size(): 2
23 Jan 03 12:46:04 DEBUG
de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:71) 	 -
<-execute(mapping, form, request, response)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AW: How to iterate over Arraylist

Posted by Gemes Tibor <ti...@i-trade.hu>.
2003. január 23. 14:42 dátummal Nicolas De Loof ezt írtad:
> What version of tomcat are you using ?

4.1.12 at the moment, but planning to upgrade soon.

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


New BeanUtil 1.6/ConvertUtils/Date Format/toString()

Posted by Jim Krygowski <ja...@shaws.com>.
Hi All-

A little while ago someone on this list emailed me directly with a question
and I didn't have the answer he wanted.  In the intervening days, I lost
this person's email, so I'm going to post to the list hoping that he will
get this message.

You asked me how one could use Rick Reumann approach of registering date
converters to convert java.util.Date when rendering a JSP page.  You were
under the same impression as I initially was: i.e. The two converters would
work automatically to convert the Date to and from a String when rendering
the HTML and reading from the Request.

Examining the code and corresponding with Rick led me to understand that
Rick's approach requires 2 beans, one that is "type-safe" the other having
only String members.  The String bean (no pun intended) is used in the JSP
to render the page.  The type-safe bean is used by the model when executing
business logic.  The Action copies between these two beans during the
transitions (getting info from the JSP, sending info to the JSP for
rendering).

Of course this means that you have to explicitly code for this in your
Action.  And it means that if you're rendering complex ValueObject graphs on
your JSP, you have to create a parallel  set of String bean type value
objects to use when rendering the JSP.  This could be a lot of extra work
initially and going forward during maintenance of the application.

I thought it would be better if ConvertUtils was smart enough to recognize
that getting a String value for an Object might involve more than just
calling toString().  Well, as of BeanUtils 1.6, ConvertUtils does recognize
converters when getting String values for objects.  So, now it seems that
Rick's two converters can now be used without an explicit conversion step
coded in your Actions.  You should be able to set it up just like Rick
explains in his posts to this mailing list and you'll see the dates
formatted correctly on your JSP when you render it.

Many thanks to whoever (Craig R. McClanahan || Ralph Schaer || Chris Audley)
made the change to ConvertUtils.

jk


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AW: How to iterate over Arraylist

Posted by Nicolas De Loof <ni...@cgey.com>.
What version of tomcat are you using ?

Nico.


> That's really stupid ;-)
>
> But now there's the next error:
>
> I think the use Bean Tag is wrong, because the Error ist:

It is a bug in tomcat 4.1.10 afaik. Upgrade to 4.1.18.

Tib

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AW: How to iterate over Arraylist

Posted by Nicolas De Loof <ni...@cgey.com>.
Could you please add this dump code in your JSP, replacing your <bean:write>
so that we could see what <logic:iterate> has done with your "person".
(Please post resulting HTML)

Nico.


<h3>PAGE_SCOPE</h3>
<%  for (java.util.Enumeration e = pageContext.getAttributeNamesInScope(
javax.servlet.jsp.PageContext.PAGE_SCOPE) ;
         e.hasMoreElements(); ) { %>
    <%= e.nextElement() %><br>
<%  } %>
<h3>REQUEST_SCOPE</h3>
<%  for (java.util.Enumeration e = pageContext.getAttributeNamesInScope(
javax.servlet.jsp.PageContext.REQUEST_SCOPE) ;
         e.hasMoreElements(); ) { %>
    <%= e.nextElement() %><br>
<%  } %>
<h3>SESSION_SCOPE</h3>
<%  for (java.util.Enumeration e = pageContext.getAttributeNamesInScope(
javax.servlet.jsp.PageContext.SESSION_SCOPE) ;
         e.hasMoreElements(); ) { %>
    <%= e.nextElement() %><br>
<%  } %>
<h3>APPLICATION_SCOPE</h3>
<%  for (java.util.Enumeration e = pageContext.getAttributeNamesInScope(
javax.servlet.jsp.PageContext.APPLICATION_SCOPE) ;
         e.hasMoreElements(); ) { %>
    <%= e.nextElement() %><br>
<%  } %>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: AW: How to iterate over Arraylist

Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
It is 4.1.18. !

Fredy


-----Ursprüngliche Nachricht-----
Von: Gemes Tibor [mailto:tib@i-trade.hu]
Gesendet: Donnerstag, 23. Januar 2003 14:10
An: Struts Users Mailing List
Betreff: Re: AW: How to iterate over Arraylist


2003. január 23. 13:36 dátummal Softwareentwicklung Hauschel ezt írtad:
> That's really stupid ;-)
>
> But now there's the next error:
>
> I think the use Bean Tag is wrong, because the Error ist:

It is a bug in tomcat 4.1.10 afaik. Upgrade to 4.1.18.

Tib

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: AW: How to iterate over Arraylist

Posted by Gemes Tibor <ti...@i-trade.hu>.
2003. január 23. 13:36 dátummal Softwareentwicklung Hauschel ezt írtad:
> That's really stupid ;-)
>
> But now there's the next error:
>
> I think the use Bean Tag is wrong, because the Error ist:

It is a bug in tomcat 4.1.10 afaik. Upgrade to 4.1.18.

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to iterate over Arraylist

Posted by Nicolas De Loof <ni...@cgey.com>.
> <jsp:useBean id="person" scope="request" class="...>

jsp:usebean will search in scope or create bean and asing a script variable
"person"

> <logic:iterate id="person" name="persons">

logic:iterate implicitly create a script variable form id attriute. This is
the reason you get "person is already defined". Just delete your
<jsp:usebean>.


I don't understand why you get this "cannot find bean person...", as
<logic:iterate> put it in pageContext.


Nico.


> But now there's the next error:
>
> I think the use Bean Tag is wrong, because the Error ist:
>
> Generated servlet error:
>     [javac] Compiling 1 source file
>
>
C:\tomcatWapen\work\Standalone\localhost\wapen\form\listpersons_jsp.java:92:
> person is already defined in
>
_jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpSer
> vletResponse)
>         java.lang.Object person = null;
>                          ^
>
>
> But if i delete the use Bean Tag, then he says:
>
> org.apache.jasper.JasperException: Cannot find bean person in any scope
>
> What is Tomcat's problem ? I think he don't know what he want !
>
> thanks, Fredy
>
>
> -----Ursprüngliche Nachricht-----
> Von: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
> Gesendet: Donnerstag, 23. Januar 2003 13:15
> An: Struts Users Mailing List
> Betreff: Re: How to iterate over Arraylist
>
>
> You just have to add at begining of your JSP :
>
> <%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>
>
> Without that, you can see that logic:xx tags appears in resulting HTML not
> beeing interpreted by JSP parser.
>
> Nico.
>
> > My JSP:
> >
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> > <jsp:useBean id="person" scope="request"
> > class="de.hauschel.wapen.bt.vo.VOPerson"/>
> > <html>
> > <head>
> > <title>Struts Form for listpersonsForm</title>
> > </head>
> > <body>
> >
> > <table border="1" width="100%">
> >   <tr>
> >     <th align="center" width="30%"> Überschrigft </th>
> >   </tr>
> >   <logic:iterate id="person" name="persons" >
> >   <tr>
> >     <td align="left"> <bean:write name="person" property="username" />
> >     </td>
> >   </tr>
> >   </logic:iterate>
> > </table>
> > </html>
> >
> > My Action:
> > public class ListpersonsAction extends WapenAction
> > {
> > public ActionForward execute(
> > ActionMapping mapping,
> > ActionForm form,
> > HttpServletRequest request,
> > HttpServletResponse response)
> > throws Exception
> > {
> > Category cat =
> > Category.getInstance(
> > "de.hauschel.wapen.struts.action.ListpersonsAction");
> >
> > cat.debug("->execute(mapping, form, request, response)");
> >
> > ListpersonsForm listpersonsForm = (ListpersonsForm) form;
> >
> > ArrayList persons = new ArrayList();
> >
> > BusinessDelegate bd = BusinessDelegate.getInstance();
> > persons.add( bd.getPerson( "fritz" ) );
> > persons.add( bd.getPerson( "fredy" ) );
> >
> > cat.debug( "persons.size(): " + persons.size() );
> >
> > request.setAttribute( "persons", persons );
> >
> > cat.debug("<-execute(mapping, form, request, response)");
> >
> > return mapping.findForward( SUCCESS );
> > }
> > }
> >
> > My Problem:
> >
> > No usernames listed !
> >
> >
> > Output of Log4j:
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:57) - ->execute(mapping, form, request, response)
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:67) -
> > persons.size(): 2
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:71) -
> > <-execute(mapping, form, request, response)
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: How to iterate over Arraylist

Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
Found the Problem !!

The first entry of the arrayList was null !!

Thanks, Fredy

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: How to iterate over Arraylist

Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
The Error.html wasn't send ?!?!
Don't know why. Here it is:

org.apache.jasper.JasperException: Cannot find bean person in any scope
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
48)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:356)
	at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
33)
	at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces
sor.java:436)
	at
org.apache.struts.action.RequestProcessor.processActionForward(RequestProces
sor.java:401)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:356)
	at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
33)
	at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces
sor.java:436)
	at
org.apache.struts.action.RequestProcessor.processActionForward(RequestProces
sor.java:401)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:386)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:530)
	at java.lang.Thread.run(Thread.java:536)


root cause

javax.servlet.ServletException: Cannot find bean person in any scope
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:530)
	at org.apache.jsp.listpersons_jsp._jspService(listpersons_jsp.java:115)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
04)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:356)
	at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
33)
	at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces
sor.java:436)
	at
org.apache.struts.action.RequestProcessor.processActionForward(RequestProces
sor.java:401)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:356)
	at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
33)
	at
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProces
sor.java:436)
	at
org.apache.struts.action.RequestProcessor.processActionForward(RequestProces
sor.java:401)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:386)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:530)
	at java.lang.Thread.run(Thread.java:536)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: How to iterate over Arraylist

Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
Hey Rene,
here are the jsp and the error !

thanks, Fredy


-----Ursprüngliche Nachricht-----
Von: René Eigenheer [mailto:reigenheer@bridgesolutions.net]
Gesendet: Donnerstag, 23. Januar 2003 14:09
An: 'Struts Users Mailing List'
Betreff: RE: How to iterate over Arraylist


how looks the actual jsp you test and what is/are the error message(s)

> -----Original Message-----
> From: Softwareentwicklung Hauschel
> [mailto:Softwareentwicklung@Hauschel.de]
> Sent: Donnerstag, 23. Januar 2003 13:55
> To: Struts Users Mailing List
> Subject: AW: How to iterate over Arraylist
>
>
> No, it doesn't works,
>
> the problem seems to be the:
> <bean:write name="person" property="username" />
>
> If i change person to person2 the errormessage change,too.
> so the error cannot be infront of <bean:write !
>
> But why ist the bean not in any scope ?
>
> thanks Fredy
>
> -----Ursprüngliche Nachricht-----
> Von: René Eigenheer [mailto:reigenheer@bridgesolutions.net]
> Gesendet: Donnerstag, 23. Januar 2003 13:49
> An: 'Struts Users Mailing List'
> Betreff: RE: How to iterate over Arraylist
>
>
> what do you use <jsp:useBean id="person" scope="request"
> class="de.hauschel.wapen.bt.vo.VOPerson"/> and not the standard struts
> (dyna)form?
>
> but if you realy need, maybe it works the following way:
>
> <jsp:useBean id="persons" scope="request"/>
>
> <logic:iterate id="person"
>   type="de.hauschel.wapen.bt.vo.VOPerson"
>   name="persons">
>
>
> > -----Original Message-----
> > From: Softwareentwicklung Hauschel
> > [mailto:Softwareentwicklung@Hauschel.de]
> > Sent: Donnerstag, 23. Januar 2003 13:37
> > To: Struts Users Mailing List
> > Subject: AW: How to iterate over Arraylist
> >
> >
> > That's really stupid ;-)
> >
> > But now there's the next error:
> >
> > I think the use Bean Tag is wrong, because the Error ist:
> >
> > Generated servlet error:
> >     [javac] Compiling 1 source file
> >
> > C:\tomcatWapen\work\Standalone\localhost\wapen\form\listperson
> > s_jsp.java:92:
> > person is already defined in
> > _jspService(javax.servlet.http.HttpServletRequest,javax.servle
> > t.http.HttpSer
> > vletResponse)
> >         java.lang.Object person = null;
> >                          ^
> >
> >
> > But if i delete the use Bean Tag, then he says:
> >
> > org.apache.jasper.JasperException: Cannot find bean person in
> > any scope
> >
> > What is Tomcat's problem ? I think he don't know what he want !
> >
> > thanks, Fredy
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
> > Gesendet: Donnerstag, 23. Januar 2003 13:15
> > An: Struts Users Mailing List
> > Betreff: Re: How to iterate over Arraylist
> >
> >
> > You just have to add at begining of your JSP :
> >
> > <%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>
> >
> > Without that, you can see that logic:xx tags appears in
> > resulting HTML not
> > beeing interpreted by JSP parser.
> >
> > Nico.
> >
> > > My JSP:
> > >
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> > > <jsp:useBean id="person" scope="request"
> > > class="de.hauschel.wapen.bt.vo.VOPerson"/>
> > > <html>
> > > <head>
> > > <title>Struts Form for listpersonsForm</title>
> > > </head>
> > > <body>
> > >
> > > <table border="1" width="100%">
> > >   <tr>
> > >     <th align="center" width="30%"> Überschrigft </th>
> > >   </tr>
> > >   <logic:iterate id="person" name="persons" >
> > >   <tr>
> > >     <td align="left"> <bean:write name="person"
> > property="username" />
> > >     </td>
> > >   </tr>
> > >   </logic:iterate>
> > > </table>
> > > </html>
> > >
> > > My Action:
> > > public class ListpersonsAction extends WapenAction
> > > {
> > > public ActionForward execute(
> > > ActionMapping mapping,
> > > ActionForm form,
> > > HttpServletRequest request,
> > > HttpServletResponse response)
> > > throws Exception
> > > {
> > > Category cat =
> > > Category.getInstance(
> > > "de.hauschel.wapen.struts.action.ListpersonsAction");
> > >
> > > cat.debug("->execute(mapping, form, request, response)");
> > >
> > > ListpersonsForm listpersonsForm = (ListpersonsForm) form;
> > >
> > > ArrayList persons = new ArrayList();
> > >
> > > BusinessDelegate bd = BusinessDelegate.getInstance();
> > > persons.add( bd.getPerson( "fritz" ) );
> > > persons.add( bd.getPerson( "fredy" ) );
> > >
> > > cat.debug( "persons.size(): " + persons.size() );
> > >
> > > request.setAttribute( "persons", persons );
> > >
> > > cat.debug("<-execute(mapping, form, request, response)");
> > >
> > > return mapping.findForward( SUCCESS );
> > > }
> > > }
> > >
> > > My Problem:
> > >
> > > No usernames listed !
> > >
> > >
> > > Output of Log4j:
> > > 23 Jan 03 12:46:04 DEBUG
> > > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > > (Line:57) - ->execute(mapping, form, request, response)
> > > 23 Jan 03 12:46:04 DEBUG
> > > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:67) -
> > > persons.size(): 2
> > > 23 Jan 03 12:46:04 DEBUG
> > > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:71) -
> > > <-execute(mapping, form, request, response)
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


RE: How to iterate over Arraylist

Posted by René Eigenheer <re...@bridgesolutions.net>.
how looks the actual jsp you test and what is/are the error message(s)

> -----Original Message-----
> From: Softwareentwicklung Hauschel
> [mailto:Softwareentwicklung@Hauschel.de]
> Sent: Donnerstag, 23. Januar 2003 13:55
> To: Struts Users Mailing List
> Subject: AW: How to iterate over Arraylist
>
>
> No, it doesn't works,
>
> the problem seems to be the:
> <bean:write name="person" property="username" />
>
> If i change person to person2 the errormessage change,too.
> so the error cannot be infront of <bean:write !
>
> But why ist the bean not in any scope ?
>
> thanks Fredy
>
> -----Ursprüngliche Nachricht-----
> Von: René Eigenheer [mailto:reigenheer@bridgesolutions.net]
> Gesendet: Donnerstag, 23. Januar 2003 13:49
> An: 'Struts Users Mailing List'
> Betreff: RE: How to iterate over Arraylist
>
>
> what do you use <jsp:useBean id="person" scope="request"
> class="de.hauschel.wapen.bt.vo.VOPerson"/> and not the standard struts
> (dyna)form?
>
> but if you realy need, maybe it works the following way:
>
> <jsp:useBean id="persons" scope="request"/>
>
> <logic:iterate id="person"
>   type="de.hauschel.wapen.bt.vo.VOPerson"
>   name="persons">
>
>
> > -----Original Message-----
> > From: Softwareentwicklung Hauschel
> > [mailto:Softwareentwicklung@Hauschel.de]
> > Sent: Donnerstag, 23. Januar 2003 13:37
> > To: Struts Users Mailing List
> > Subject: AW: How to iterate over Arraylist
> >
> >
> > That's really stupid ;-)
> >
> > But now there's the next error:
> >
> > I think the use Bean Tag is wrong, because the Error ist:
> >
> > Generated servlet error:
> >     [javac] Compiling 1 source file
> >
> > C:\tomcatWapen\work\Standalone\localhost\wapen\form\listperson
> > s_jsp.java:92:
> > person is already defined in
> > _jspService(javax.servlet.http.HttpServletRequest,javax.servle
> > t.http.HttpSer
> > vletResponse)
> >         java.lang.Object person = null;
> >                          ^
> >
> >
> > But if i delete the use Bean Tag, then he says:
> >
> > org.apache.jasper.JasperException: Cannot find bean person in
> > any scope
> >
> > What is Tomcat's problem ? I think he don't know what he want !
> >
> > thanks, Fredy
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
> > Gesendet: Donnerstag, 23. Januar 2003 13:15
> > An: Struts Users Mailing List
> > Betreff: Re: How to iterate over Arraylist
> >
> >
> > You just have to add at begining of your JSP :
> >
> > <%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>
> >
> > Without that, you can see that logic:xx tags appears in
> > resulting HTML not
> > beeing interpreted by JSP parser.
> >
> > Nico.
> >
> > > My JSP:
> > >
> > > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> > > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> > > <jsp:useBean id="person" scope="request"
> > > class="de.hauschel.wapen.bt.vo.VOPerson"/>
> > > <html>
> > > <head>
> > > <title>Struts Form for listpersonsForm</title>
> > > </head>
> > > <body>
> > >
> > > <table border="1" width="100%">
> > >   <tr>
> > >     <th align="center" width="30%"> Überschrigft </th>
> > >   </tr>
> > >   <logic:iterate id="person" name="persons" >
> > >   <tr>
> > >     <td align="left"> <bean:write name="person"
> > property="username" />
> > >     </td>
> > >   </tr>
> > >   </logic:iterate>
> > > </table>
> > > </html>
> > >
> > > My Action:
> > > public class ListpersonsAction extends WapenAction
> > > {
> > > public ActionForward execute(
> > > ActionMapping mapping,
> > > ActionForm form,
> > > HttpServletRequest request,
> > > HttpServletResponse response)
> > > throws Exception
> > > {
> > > Category cat =
> > > Category.getInstance(
> > > "de.hauschel.wapen.struts.action.ListpersonsAction");
> > >
> > > cat.debug("->execute(mapping, form, request, response)");
> > >
> > > ListpersonsForm listpersonsForm = (ListpersonsForm) form;
> > >
> > > ArrayList persons = new ArrayList();
> > >
> > > BusinessDelegate bd = BusinessDelegate.getInstance();
> > > persons.add( bd.getPerson( "fritz" ) );
> > > persons.add( bd.getPerson( "fredy" ) );
> > >
> > > cat.debug( "persons.size(): " + persons.size() );
> > >
> > > request.setAttribute( "persons", persons );
> > >
> > > cat.debug("<-execute(mapping, form, request, response)");
> > >
> > > return mapping.findForward( SUCCESS );
> > > }
> > > }
> > >
> > > My Problem:
> > >
> > > No usernames listed !
> > >
> > >
> > > Output of Log4j:
> > > 23 Jan 03 12:46:04 DEBUG
> > > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > > (Line:57) - ->execute(mapping, form, request, response)
> > > 23 Jan 03 12:46:04 DEBUG
> > > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:67) -
> > > persons.size(): 2
> > > 23 Jan 03 12:46:04 DEBUG
> > > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:71) -
> > > <-execute(mapping, form, request, response)
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: How to iterate over Arraylist

Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
No, it doesn't works,

the problem seems to be the:
<bean:write name="person" property="username" />

If i change person to person2 the errormessage change,too.
so the error cannot be infront of <bean:write !

But why ist the bean not in any scope ?

thanks Fredy

-----Ursprüngliche Nachricht-----
Von: René Eigenheer [mailto:reigenheer@bridgesolutions.net]
Gesendet: Donnerstag, 23. Januar 2003 13:49
An: 'Struts Users Mailing List'
Betreff: RE: How to iterate over Arraylist


what do you use <jsp:useBean id="person" scope="request"
class="de.hauschel.wapen.bt.vo.VOPerson"/> and not the standard struts
(dyna)form?

but if you realy need, maybe it works the following way:

<jsp:useBean id="persons" scope="request"/>

<logic:iterate id="person"
  type="de.hauschel.wapen.bt.vo.VOPerson"
  name="persons">


> -----Original Message-----
> From: Softwareentwicklung Hauschel
> [mailto:Softwareentwicklung@Hauschel.de]
> Sent: Donnerstag, 23. Januar 2003 13:37
> To: Struts Users Mailing List
> Subject: AW: How to iterate over Arraylist
>
>
> That's really stupid ;-)
>
> But now there's the next error:
>
> I think the use Bean Tag is wrong, because the Error ist:
>
> Generated servlet error:
>     [javac] Compiling 1 source file
>
> C:\tomcatWapen\work\Standalone\localhost\wapen\form\listperson
> s_jsp.java:92:
> person is already defined in
> _jspService(javax.servlet.http.HttpServletRequest,javax.servle
> t.http.HttpSer
> vletResponse)
>         java.lang.Object person = null;
>                          ^
>
>
> But if i delete the use Bean Tag, then he says:
>
> org.apache.jasper.JasperException: Cannot find bean person in
> any scope
>
> What is Tomcat's problem ? I think he don't know what he want !
>
> thanks, Fredy
>
>
> -----Ursprüngliche Nachricht-----
> Von: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
> Gesendet: Donnerstag, 23. Januar 2003 13:15
> An: Struts Users Mailing List
> Betreff: Re: How to iterate over Arraylist
>
>
> You just have to add at begining of your JSP :
>
> <%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>
>
> Without that, you can see that logic:xx tags appears in
> resulting HTML not
> beeing interpreted by JSP parser.
>
> Nico.
>
> > My JSP:
> >
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> > <jsp:useBean id="person" scope="request"
> > class="de.hauschel.wapen.bt.vo.VOPerson"/>
> > <html>
> > <head>
> > <title>Struts Form for listpersonsForm</title>
> > </head>
> > <body>
> >
> > <table border="1" width="100%">
> >   <tr>
> >     <th align="center" width="30%"> Überschrigft </th>
> >   </tr>
> >   <logic:iterate id="person" name="persons" >
> >   <tr>
> >     <td align="left"> <bean:write name="person"
> property="username" />
> >     </td>
> >   </tr>
> >   </logic:iterate>
> > </table>
> > </html>
> >
> > My Action:
> > public class ListpersonsAction extends WapenAction
> > {
> > public ActionForward execute(
> > ActionMapping mapping,
> > ActionForm form,
> > HttpServletRequest request,
> > HttpServletResponse response)
> > throws Exception
> > {
> > Category cat =
> > Category.getInstance(
> > "de.hauschel.wapen.struts.action.ListpersonsAction");
> >
> > cat.debug("->execute(mapping, form, request, response)");
> >
> > ListpersonsForm listpersonsForm = (ListpersonsForm) form;
> >
> > ArrayList persons = new ArrayList();
> >
> > BusinessDelegate bd = BusinessDelegate.getInstance();
> > persons.add( bd.getPerson( "fritz" ) );
> > persons.add( bd.getPerson( "fredy" ) );
> >
> > cat.debug( "persons.size(): " + persons.size() );
> >
> > request.setAttribute( "persons", persons );
> >
> > cat.debug("<-execute(mapping, form, request, response)");
> >
> > return mapping.findForward( SUCCESS );
> > }
> > }
> >
> > My Problem:
> >
> > No usernames listed !
> >
> >
> > Output of Log4j:
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:57) - ->execute(mapping, form, request, response)
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> (Line:67) -
> > persons.size(): 2
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> (Line:71) -
> > <-execute(mapping, form, request, response)
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to iterate over Arraylist

Posted by René Eigenheer <re...@bridgesolutions.net>.
what do you use <jsp:useBean id="person" scope="request"
class="de.hauschel.wapen.bt.vo.VOPerson"/> and not the standard struts
(dyna)form?

but if you realy need, maybe it works the following way:

<jsp:useBean id="persons" scope="request"/>

<logic:iterate id="person"
  type="de.hauschel.wapen.bt.vo.VOPerson"
  name="persons">


> -----Original Message-----
> From: Softwareentwicklung Hauschel
> [mailto:Softwareentwicklung@Hauschel.de]
> Sent: Donnerstag, 23. Januar 2003 13:37
> To: Struts Users Mailing List
> Subject: AW: How to iterate over Arraylist
>
>
> That's really stupid ;-)
>
> But now there's the next error:
>
> I think the use Bean Tag is wrong, because the Error ist:
>
> Generated servlet error:
>     [javac] Compiling 1 source file
>
> C:\tomcatWapen\work\Standalone\localhost\wapen\form\listperson
> s_jsp.java:92:
> person is already defined in
> _jspService(javax.servlet.http.HttpServletRequest,javax.servle
> t.http.HttpSer
> vletResponse)
>         java.lang.Object person = null;
>                          ^
>
>
> But if i delete the use Bean Tag, then he says:
>
> org.apache.jasper.JasperException: Cannot find bean person in
> any scope
>
> What is Tomcat's problem ? I think he don't know what he want !
>
> thanks, Fredy
>
>
> -----Ursprüngliche Nachricht-----
> Von: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
> Gesendet: Donnerstag, 23. Januar 2003 13:15
> An: Struts Users Mailing List
> Betreff: Re: How to iterate over Arraylist
>
>
> You just have to add at begining of your JSP :
>
> <%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>
>
> Without that, you can see that logic:xx tags appears in
> resulting HTML not
> beeing interpreted by JSP parser.
>
> Nico.
>
> > My JSP:
> >
> > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> > <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> > <jsp:useBean id="person" scope="request"
> > class="de.hauschel.wapen.bt.vo.VOPerson"/>
> > <html>
> > <head>
> > <title>Struts Form for listpersonsForm</title>
> > </head>
> > <body>
> >
> > <table border="1" width="100%">
> >   <tr>
> >     <th align="center" width="30%"> Überschrigft </th>
> >   </tr>
> >   <logic:iterate id="person" name="persons" >
> >   <tr>
> >     <td align="left"> <bean:write name="person"
> property="username" />
> >     </td>
> >   </tr>
> >   </logic:iterate>
> > </table>
> > </html>
> >
> > My Action:
> > public class ListpersonsAction extends WapenAction
> > {
> > public ActionForward execute(
> > ActionMapping mapping,
> > ActionForm form,
> > HttpServletRequest request,
> > HttpServletResponse response)
> > throws Exception
> > {
> > Category cat =
> > Category.getInstance(
> > "de.hauschel.wapen.struts.action.ListpersonsAction");
> >
> > cat.debug("->execute(mapping, form, request, response)");
> >
> > ListpersonsForm listpersonsForm = (ListpersonsForm) form;
> >
> > ArrayList persons = new ArrayList();
> >
> > BusinessDelegate bd = BusinessDelegate.getInstance();
> > persons.add( bd.getPerson( "fritz" ) );
> > persons.add( bd.getPerson( "fredy" ) );
> >
> > cat.debug( "persons.size(): " + persons.size() );
> >
> > request.setAttribute( "persons", persons );
> >
> > cat.debug("<-execute(mapping, form, request, response)");
> >
> > return mapping.findForward( SUCCESS );
> > }
> > }
> >
> > My Problem:
> >
> > No usernames listed !
> >
> >
> > Output of Log4j:
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> > (Line:57) - ->execute(mapping, form, request, response)
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> (Line:67) -
> > persons.size(): 2
> > 23 Jan 03 12:46:04 DEBUG
> > de.hauschel.wapen.struts.action.ListpersonsAction.execute
> (Line:71) -
> > <-execute(mapping, form, request, response)
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


AW: How to iterate over Arraylist

Posted by Softwareentwicklung Hauschel <So...@Hauschel.de>.
That's really stupid ;-)

But now there's the next error:

I think the use Bean Tag is wrong, because the Error ist:

Generated servlet error:
    [javac] Compiling 1 source file

C:\tomcatWapen\work\Standalone\localhost\wapen\form\listpersons_jsp.java:92:
person is already defined in
_jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpSer
vletResponse)
        java.lang.Object person = null;
                         ^


But if i delete the use Bean Tag, then he says:

org.apache.jasper.JasperException: Cannot find bean person in any scope

What is Tomcat's problem ? I think he don't know what he want !

thanks, Fredy


-----Ursprüngliche Nachricht-----
Von: Nicolas De Loof [mailto:nicolas.deloof@cgey.com]
Gesendet: Donnerstag, 23. Januar 2003 13:15
An: Struts Users Mailing List
Betreff: Re: How to iterate over Arraylist


You just have to add at begining of your JSP :

<%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>

Without that, you can see that logic:xx tags appears in resulting HTML not
beeing interpreted by JSP parser.

Nico.

> My JSP:
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> <jsp:useBean id="person" scope="request"
> class="de.hauschel.wapen.bt.vo.VOPerson"/>
> <html>
> <head>
> <title>Struts Form for listpersonsForm</title>
> </head>
> <body>
>
> <table border="1" width="100%">
>   <tr>
>     <th align="center" width="30%"> Überschrigft </th>
>   </tr>
>   <logic:iterate id="person" name="persons" >
>   <tr>
>     <td align="left"> <bean:write name="person" property="username" />
>     </td>
>   </tr>
>   </logic:iterate>
> </table>
> </html>
>
> My Action:
> public class ListpersonsAction extends WapenAction
> {
> public ActionForward execute(
> ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception
> {
> Category cat =
> Category.getInstance(
> "de.hauschel.wapen.struts.action.ListpersonsAction");
>
> cat.debug("->execute(mapping, form, request, response)");
>
> ListpersonsForm listpersonsForm = (ListpersonsForm) form;
>
> ArrayList persons = new ArrayList();
>
> BusinessDelegate bd = BusinessDelegate.getInstance();
> persons.add( bd.getPerson( "fritz" ) );
> persons.add( bd.getPerson( "fredy" ) );
>
> cat.debug( "persons.size(): " + persons.size() );
>
> request.setAttribute( "persons", persons );
>
> cat.debug("<-execute(mapping, form, request, response)");
>
> return mapping.findForward( SUCCESS );
> }
> }
>
> My Problem:
>
> No usernames listed !
>
>
> Output of Log4j:
> 23 Jan 03 12:46:04 DEBUG
> de.hauschel.wapen.struts.action.ListpersonsAction.execute
> (Line:57) - ->execute(mapping, form, request, response)
> 23 Jan 03 12:46:04 DEBUG
> de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:67) -
> persons.size(): 2
> 23 Jan 03 12:46:04 DEBUG
> de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:71) -
> <-execute(mapping, form, request, response)
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to iterate over Arraylist

Posted by Nicolas De Loof <ni...@cgey.com>.
You just have to add at begining of your JSP :

<%@ taglib uri="/WEB-INF/struts-loigc.tld" prefix="logic"%>

Without that, you can see that logic:xx tags appears in resulting HTML not
beeing interpreted by JSP parser.

Nico.

> My JSP:
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
> <jsp:useBean id="person" scope="request"
> class="de.hauschel.wapen.bt.vo.VOPerson"/>
> <html>
> <head>
> <title>Struts Form for listpersonsForm</title>
> </head>
> <body>
>
> <table border="1" width="100%">
>   <tr>
>     <th align="center" width="30%"> Überschrigft </th>
>   </tr>
>   <logic:iterate id="person" name="persons" >
>   <tr>
>     <td align="left"> <bean:write name="person" property="username" />
>     </td>
>   </tr>
>   </logic:iterate>
> </table>
> </html>
>
> My Action:
> public class ListpersonsAction extends WapenAction
> {
> public ActionForward execute(
> ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception
> {
> Category cat =
> Category.getInstance(
> "de.hauschel.wapen.struts.action.ListpersonsAction");
>
> cat.debug("->execute(mapping, form, request, response)");
>
> ListpersonsForm listpersonsForm = (ListpersonsForm) form;
>
> ArrayList persons = new ArrayList();
>
> BusinessDelegate bd = BusinessDelegate.getInstance();
> persons.add( bd.getPerson( "fritz" ) );
> persons.add( bd.getPerson( "fredy" ) );
>
> cat.debug( "persons.size(): " + persons.size() );
>
> request.setAttribute( "persons", persons );
>
> cat.debug("<-execute(mapping, form, request, response)");
>
> return mapping.findForward( SUCCESS );
> }
> }
>
> My Problem:
>
> No usernames listed !
>
>
> Output of Log4j:
> 23 Jan 03 12:46:04 DEBUG
> de.hauschel.wapen.struts.action.ListpersonsAction.execute
> (Line:57) - ->execute(mapping, form, request, response)
> 23 Jan 03 12:46:04 DEBUG
> de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:67) -
> persons.size(): 2
> 23 Jan 03 12:46:04 DEBUG
> de.hauschel.wapen.struts.action.ListpersonsAction.execute (Line:71) -
> <-execute(mapping, form, request, response)
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to iterate over Arraylist

Posted by Gemes Tibor <ti...@i-trade.hu>.
2003. január 23. 12:46 dátummal Softwareentwicklung Hauschel ezt írtad:
> Hey all,
> does anybody knows a nice tutorial about iterating ?

> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

The logic taglib directive is missing

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to iterate over Arraylist

Posted by Mark Galbreath <ma...@qat.com>.
"Iteration" has scores, if not hundreds, of references in the archive:

http://www.mail-archive.com/struts-user%40jakarta.apache.org/

Mark

-----Original Message-----
From: Softwareentwicklung Hauschel [mailto:Softwareentwicklung@Hauschel.de] 
Sent: Thursday, January 23, 2003 6:47 AM

does anybody knows a nice tutorial about iterating ?
I'm to stupid...



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>