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">
How can i access the Bean and its variables from the logic tags?
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.
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,
i had wrong get/set-methods for the parameter in my Bean :-)