Hi,
i try to unserstand the struts taglibs and have some problems with tags and beans.
I stored a User-Bean (Class myapp.UserBean) in the session.
Now i want to check, if this Bean is present in the session and if it is, i want compare a variable from this Bean (UserBean.gid) with a value.
My problem is, that this is not working:
<logic:present name="UserBean" scope="session">
<logic:equal name="UserBean" property="gid" value="1">
......
</logic:equal>
</logic:present>
How can i access the Bean and its variables from the logic tags?
Thx
Naggi
-
logic:present and logic:equals problem (3 messages)
- Posted by: Stefan Janz
- Posted on: March 22 2005 12:35 EST
Threaded Messages (3)
- logic:present and logic:equals problem by Rich Hill on March 22 2005 13:38 EST
- logic:present and logic:equals problem by Rakesh Malpani on March 22 2005 16:42 EST
- Nice.... by Stefan Janz on March 22 2005 17:52 EST
-
logic:present and logic:equals problem[ Go to top ]
- Posted by: Rich Hill
- Posted on: March 22 2005 13:38 EST
- in response to Stefan Janz
I would probably use JSTL instead of Struts logic tags here, they should always be preferred, but in lieu of that
The name attribute in your tags is the first parameter used in the setAttribute() method of the Action class (assuming that you were using a Struts Action to set that bean in the session). Hopefully that helps with the outer tag.
Make sure that the getter/setter methods for the gid property are properly named by convention for the bean. -
logic:present and logic:equals problem[ Go to top ]
- Posted by: Rakesh Malpani
- Posted on: March 22 2005 16:42 EST
- in response to Stefan Janz
I guess you'll have to use the session attribute assigned to the instance instead of the class name. eg. if the instance was stored under the attribute session.setAttribute("userInfo", obj), then try using userInfo instead of UserBean etc..
Hope this helps,
Rakesh. -
Nice....[ Go to top ]
- Posted by: Stefan Janz
- Posted on: March 22 2005 17:52 EST
- in response to Rakesh Malpani
it works...
i had wrong get/set-methods for the parameter in my Bean :-)