Solved

How to access a boolean value on a object using JSTL

Posted on 2010-11-11
3
900 Views
Last Modified: 2012-05-10
I have a User object defined as follows:

public class User implements Serializable {
         private String userId;
         private boolean writeRole;
      
      public User(String userId, boolean writeRole) {
            this.userId = userId;
            this.writeRole = writeRole;
      }
      
      public String getUserId() {
            return userId;
      }
      
      public boolean hasWriteRole() {
            return writeRole;
      }      
}

I have added an instance of this object to the httpsession.
in the JSP I am using JSTL to retrieve the writeRole property:

<c:if test="${sessionScope.adminuser.readRole}" >

This is throwing a compiler error javax.servlet.jsp.el.ELException: Unable to find a value for "writeRole" in object of class "com.examples.User" using operator "."

how can I access this value using JSTL?

Thanks In advance


0
Comment
Question by:singh101
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
ioanton earned 500 total points
ID: 34113572
change the name of the method hasWriteRole() with either getWriteRole() or isWriteRole()
0
 

Author Closing Comment

by:singh101
ID: 34113687
Thanks - will probably change the field name to be more meaningful isWriteRoleAllowed
0
 

Author Comment

by:singh101
ID: 34119228
I would be grateful if you could help me with the following related question

http://www.experts-exchange.com/Programming/Languages/Java/J2EE/Q_26608149.html

Thanks In Advance
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Stuck in Bootstrap WysiHtml Editor 3 37
object methods vs static methods 2 94
constructor overloading 2 79
spring example errors 33 263
With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
An analysis of the phishing scam that has been affecting Google users, along with steps to take for protection, as well as what to do if you receive one of the emails.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now