You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Geoffrey Van Nuffelen <ge...@cora.be> on 2001/06/11 17:16:02 UTC

Re: Logic-Iterate not finding scope of Bean - error ???

Hi all,

I have the same goal of Kat Luna.. and I have the same syntax.
But for me, I think that the error come from the <bean:write > tag. This tag
don't find the scope of the bean and then don't find the bean.
I really don't know what I have to do.. I don't think so that use the
standard jsp method is MVC compliant.

Please is there a solution ?
Thanks in advance,
Geoffrey...

----- Original Message -----
From: "Charlesworth, Chico" <Ch...@softwareag.co.uk>
To: <st...@jakarta.apache.org>
Sent: Friday, June 08, 2001 4:54 PM
Subject: RE: Logic-Iterate not finding scope of Bean


> you can also have two separate action classes that use the same form,
where
> you use the first action class when you first go into that page, then use
> the second when you are submitting or whatever in the form
>
> -----Original Message-----
> From: Luna, Kat [mailto:Kat.Luna@emergis.com]
> Sent: Thursday, June 07, 2001 7:58 PM
> To: struts-user@jakarta.apache.org
> Subject: Logic-Iterate not finding scope of Bean
>
>
>
>
> Hi all, me again with my afternoon question..
>
>
> I have a UserAction class that extracts a list of Users from the database
> and stores them in an ArrayList.  Success from this Action forwards to
> user.jsp which I want to display the list in table format.  I have:
>
> <%@ page language="java" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <html:html>
> <head><title></title>
> </head>
> <body>
>
> <table>
>
>   <logic:iterate id="user" name="UserAction" property="userList"
> type="com.test.User">
>
>         <TR>
>         <TD><bean:write name="user" property="username"/></TD>
>         <TD><bean:write name="user" property="password"/></TD>
>         </TR>
>
>   </logic:iterate>
>
> ..etc
>
> but this causes the UserAction to run again (essentially calling the
> database and building the ArrayList again). Is there a way to have this
bean
> init() when the jsp page loads and then iterate through the ArrayList
> instead of calling the Action first and then displaying the page?  And if
> so, do I need to add anything to struts-config.xml to tell the page where
to
> find/identify the UserAction bean?
>
> Thanks,
>
>
> Kat Luna
> Web Developer,
> BCE Emergis
> Kat.Luna@emergis.com
>
>
> --
> The content of this e-mail is confidential, may contain privileged
material
> and is intended solely for the recipient(s) named above. If you receive
this
> in error, please notify Software AG immediately and delete this e-mail.
>
> Software AG (UK) Limited
> Registered in England & Wales 1310740
> Registered Office: Hudson House, Hudson Way,
> Pride Park, Derby DE24 8HS


Re: No getter method

Posted by Oleg V Alexeev <go...@penza.net>.
Hello Gus,

Wednesday, June 13, 2001, 11:03:05 PM, you wrote:

GD> I'm trying to re-write the example included in the struts package. I made
GD> some changes to the code and now when I try to bring the registration.jsp
GD> with an action="Edit". I get an error: No getter method for property
GD> mypropertyname of bean mybeanname. I change what I think is everything I
GD> needed to change to use that property (the Form bean, the Action bean, the
GD> struts-config.xml, etc) I'm missing something?

You must search changed jsp pages to find reference to 'mybeanname' or
to 'mypropertyname' from struts tags.

GD> How does struts know which property is map to which getter and setter?

With Java reflection API.

-- 
Best regards,
 Oleg                            mailto:gonza@penza.net



Re: No getter method

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 13 Jun 2001, Gus Delgado wrote:

> I'm trying to re-write the example included in the struts package. I made
> some changes to the code and now when I try to bring the registration.jsp
> with an action="Edit". I get an error: No getter method for property
> mypropertyname of bean mybeanname. I change what I think is everything I
> needed to change to use that property (the Form bean, the Action bean, the
> struts-config.xml, etc) I'm missing something?
> 
> How does struts know which property is map to which getter and setter?
> 

Struts uses the naming design patterns of the JavaBeans
specification.  Therefore, if you have a property named "foo", it looks
for methods getFoo() and setFoo(), while a method "fooBar" would get
translated to "getFooBar()" and setFooBar()".  You can also override these
method names by providing a BeanInfo class for your bean -- see the
JavaBeans spec for more information.

One thing to note is that the property types have to match as well:

    public String getFoo();
    public void setFoo(String foo);

If the property types don't match, or you have more than one setter (with
different types), the property will not be recognized.

> Your help is much appreaciated.
> 
> 

Craig McClanahan



No getter method

Posted by Gus Delgado <gu...@netquotient.com>.
I'm trying to re-write the example included in the struts package. I made
some changes to the code and now when I try to bring the registration.jsp
with an action="Edit". I get an error: No getter method for property
mypropertyname of bean mybeanname. I change what I think is everything I
needed to change to use that property (the Form bean, the Action bean, the
struts-config.xml, etc) I'm missing something?

How does struts know which property is map to which getter and setter?

Your help is much appreaciated.