struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: problems with bean:write tag
Date Tue, 19 Feb 2002 14:29:14 GMT

Yes, I've run into this many times.  The setter and getter must match types
(i.e. if you are setting an Integer, you must have a getter for an
Integer).  In addition, I've had problems overloading these methods.  For
instance, many times I want an alternate setter which accepts a primitive
int which just calls the main setter which takes the Integer.  Adding this
alternate setter method or any alternate getter method caused the
PropertyUtils object to complain.  I can live with this because of all the
benefits of beans.


Andrew Goodnough
Dana Commercial Credit
(419) 891-2065

                    <keithbaconstruts@        To:     Struts Users Mailing List <>
          >                cc:                                     
                                              Subject:     Re: problems with bean:write tag
                    02/19/2002 09:05                                                     
                    Please respond to                                                    
                    "Struts Users                                                        
                    Mailing List"                                                        

I always meant to find out for sure but I think it may be because you don't
have a setter method.
If you don't have matching get/set it's not a property. (according to the
spec I believe) & also according to struts.
Please let us know if that is what was wrong.

--- wrote:
> I am putting an object in the session from my Action class.
> like this:
> myObject = SomeOtherClass.getMyObject();
> HttpSession session = req.getSession();
> session.setAttribute("MyObjectKey", myObject);
> Then in my forwarded JSP,
> I am using <bean:write name="MyObjectKey" property="password"/>
> This is the exception I get:
> javax.servlet.jsp.JspException: No getter method for property password of
> bean myObject
> at org.apache.struts.util.RequestUtils.lookup(
> at org.apache.struts.taglib.bean.WriteTag.doStartTag(
> The funny thing is, if I do a "session.getAttribute("MyObjectKey")" and
> then do <%=myObjectReference.getPassword()%> in my JSP,  I am able to
> the property's value without any problem. So, the object is in fact in
> session and ofcourse has the getter method too.
> Then what is wrong?
> Anybody else faced the same problem?
> Thanks,
> -Shyam Gourisetty
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message