You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Theodosios Paschalidis <th...@hotmail.com> on 2004/03/15 20:03:51 UTC

Accessing boolean attribute using

Hi all,

I have unsuccessfuly spent all this time trying to figure this and it must be very simple...
In my JSP I have code like this: 
<logic:equal scope="session" name="userid" property="Admin" value="false">

for a bean boolean property defined like this:
  private boolean admin = false;
 public boolean isAdmin(){   return admin; }
public void setAdmin(boolean b) { admin = b;}

I get this error trying to access my JSP
org.apache.jasper.JasperException: Exception accessing property Admin for bean userid: java.lang.NoSuchMethodException: Unknown property 'Admin'

I am sure I read somewhere that boolean properties can be also used. why the java.lang.NoSuchMethodException? Is it only meant to work with Strings?
The property must be picked up correctly since I successfully use it my actions.
Any ideas on how to achieve that check using Strut tags? (have looked everywhere for an example!)

Thank you for your time,
Theo

RE: Accessing boolean attribute using

Posted by Robert Taylor <rt...@mulework.com>.
Try this:
<logic:equal scope="session" name="userid" property="admin" value="false">

robert
> -----Original Message-----
> From: Theodosios Paschalidis [mailto:theopa7@hotmail.com]
> Sent: Monday, March 15, 2004 2:04 PM
> To: struts-user@jakarta.apache.org
> Subject: Accessing boolean attribute using <logic>
> 
> 
> Hi all,
> 
> I have unsuccessfuly spent all this time trying to figure this and it must be very simple...
> In my JSP I have code like this: 
> <logic:equal scope="session" name="userid" property="Admin" value="false">
> 
> for a bean boolean property defined like this:
>   private boolean admin = false;
>  public boolean isAdmin(){   return admin; }
> public void setAdmin(boolean b) { admin = b;}
> 
> I get this error trying to access my JSP
> org.apache.jasper.JasperException: Exception accessing property Admin for bean userid: java.lang.NoSuchMethodException: 
> Unknown property 'Admin'
> 
> I am sure I read somewhere that boolean properties can be also used. why the java.lang.NoSuchMethodException? Is it only 
> meant to work with Strings?
> The property must be picked up correctly since I successfully use it my actions.
> Any ideas on how to achieve that check using Strut tags? (have looked everywhere for an example!)
> 
> Thank you for your time,
> Theo

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org