How to access a boolean value on a object using JSTL

Posted on 2010-11-11
Medium Priority
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

Question by:singh101
  • 2

Accepted Solution

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

Author Closing Comment

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

Author Comment

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


Thanks In Advance

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
The narrative of smartphone revolution is incomplete without the mention of apps, for the latter is being used today for a variety of purposes. From booking hotel (or plane) tickets to ordering food to even conducting small businesses, mobiles apps …
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…
Suggested Courses

624 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