You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sg...@sears.com on 2002/02/15 20:05:14 UTC

problems with bean:write tag

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(RequestUtils.java:536)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)

The funny thing is, if I do a "session.getAttribute("MyObjectKey")" and
then do <%=myObjectReference.getPassword()%> in my JSP,  I am able to print
the property's value without any problem. So, the object is in fact in the
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problems with bean:write tag

Posted by Keith <ke...@yahoo.com>.
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 bean
spec I believe) & also according to struts.
Please let us know if that is what was wrong.

--- sgouris@sears.com 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(RequestUtils.java:536)
> at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179)
> 
> The funny thing is, if I do a "session.getAttribute("MyObjectKey")" and
> then do <%=myObjectReference.getPassword()%> in my JSP,  I am able to print
> the property's value without any problem. So, the object is in fact in the
> 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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

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