> <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:[EMAIL PROTECTED]]
> 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:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to