You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sh...@us.abb.com on 2002/11/14 22:08:14 UTC

Why doesnt logic:iterate use the formBean from the html:form



<html:form action="/helpMe">
   <logic:iterate property="infoItems">

  </logic:iterate>
</html:form>

I assumed that iterate tag would look for a property infoItems on the
formBean for the html:form

But it doesnt?

If the "name" attribute is required then shouldnt it complain against
the TLD?

Rather you have to specify:

<logic:iterate name="compressedInfoForm" property="infoItems">
.....

Now ofcourse I dont like this since now I have this string
"compressedInfoForm" that has
been defined in the struts-config.xml and if I change it there I have to
remember to change
it everywhere.

Is there a better mechanism to get the name of the formBean without
hardcoding?

-Shakeel




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


Re: Using : Tomcat 3.2.2

Posted by Antoni Reus <an...@wanadoo.es>.
Hi,

Can you be more specific?
Can you post an snip of your code?

Salut!

-- Antoni Reus

A Dissabte 16 Novembre 2002 17:32, vze49jqg va escriure:
> Hi I am using Tomcat 3.2.2 , struts 1.0
> I am having this problem :
>
>     I have a ArrayList myArr which is populated by the Bean {A} , the
> arraylist contains object of another Bean {B}.
>
>     if I say
> <logic:iterate name="myfs" property="myArrlst">
> Hello World
> </logic:iterate>
>
> It iterates Hello world for the number of objects in myArrlst,
> but when I try to use a method call inside the logic:iterate tag it says
> getter / setter not present.
> I can do the same thing as above with Java Iterator and calling bean's
> individual getter/ setter methods.
>
>
> Any help will be greatly appreciated.
> Regards
> Gopal


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


RE: Using : Tomcat 3.2.2

Posted by Xavier Combelle <xc...@kaptech.com>.
it seems that you did not used the id attribute
 <logic:iterate id="item" name="myfs" property="myArrlst">
	<bean:write name="item" property="yourProperty"/>
 </logic:iterate>
> -----Message d'origine-----
> De : vze49jqg [mailto:vze49jqg@verizon.net]
> Envoyé : samedi 16 novembre 2002 17:32
> À : Struts Users Mailing List
> Objet : Using : Tomcat 3.2.2
>
>
> Hi I am using Tomcat 3.2.2 , struts 1.0
> I am having this problem :
>
>     I have a ArrayList myArr which is populated by the Bean {A} , the
> arraylist contains object of another Bean {B}.
>
>     if I say
> <logic:iterate name="myfs" property="myArrlst">
> Hello World
> </logic:iterate>
>
> It iterates Hello world for the number of objects in myArrlst,
> but when I try to use a method call inside the logic:iterate tag it says
> getter / setter not present.
> I can do the same thing as above with Java Iterator and calling bean's
> individual getter/ setter methods.
>
>
> Any help will be greatly appreciated.
> Regards
> Gopal
>
>
>
> --
> 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>


Using : Tomcat 3.2.2

Posted by vze49jqg <vz...@verizon.net>.
Hi I am using Tomcat 3.2.2 , struts 1.0
I am having this problem :

    I have a ArrayList myArr which is populated by the Bean {A} , the
arraylist contains object of another Bean {B}.

    if I say
<logic:iterate name="myfs" property="myArrlst">
Hello World
</logic:iterate>

It iterates Hello world for the number of objects in myArrlst,
but when I try to use a method call inside the logic:iterate tag it says
getter / setter not present.
I can do the same thing as above with Java Iterator and calling bean's
individual getter/ setter methods.


Any help will be greatly appreciated.
Regards
Gopal



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


Re: Why doesnt logic:iterate use the formBean from the html:form

Posted by Arron Bates <st...@keyboardmonkey.com>.
> > <html:form action="/helpMe">
> >    <logic:iterate property="infoItems">
> >
> >   </logic:iterate>
> > </html:form>
> >
> > I assumed that iterate tag would look for a property infoItems on the
> > formBean for the html:form
> >
> > But it doesnt?

The nested tags work in exactly this fashion, picking up on the form
bean and then having all the name attributes more or less taken care of
as you've asked.

And as martin says, assumptions shouldn't be made about the html/form
nature, so if you find yourself wanting to make WML, there's a
<nested:root> tag you can use to point at an arbitrary bean reference.


There's docco on the nested tags on the Struts site, but there's a
primer and a tutorial to get you started on...

http://www.keyboardmonkey.com/next

...I'm quite sure you'll find them a good fit.



Arron.


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


Re: Why doesnt logic:iterate use the formBean from the html:form

Posted by Martin Cooper <ma...@apache.org>.

On Thu, 14 Nov 2002 shakeel.mahate@us.abb.com wrote:

>
>
>
> <html:form action="/helpMe">
>    <logic:iterate property="infoItems">
>
>   </logic:iterate>
> </html:form>
>
> I assumed that iterate tag would look for a property infoItems on the
> formBean for the html:form
>
> But it doesnt?

No, it doesn't. You are assuming that JSP pages are only used to generate
HTML, which is an invalid assumption. If I want to use JSP to create, for
example, WML pages, I should still be able to use the Struts logic tags to
do so. If the logic tags made assumptions about the existence of HTML
tags, I would not be able to do that.

--
Martin Cooper


>
> If the "name" attribute is required then shouldnt it complain against
> the TLD?
>
> Rather you have to specify:
>
> <logic:iterate name="compressedInfoForm" property="infoItems">
> .....
>
> Now ofcourse I dont like this since now I have this string
> "compressedInfoForm" that has
> been defined in the struts-config.xml and if I change it there I have to
> remember to change
> it everywhere.
>
> Is there a better mechanism to get the name of the formBean without
> hardcoding?
>
> -Shakeel
>
>
>
>
> --
> 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>