Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to access a boolean value on a object using JSTL

Posted on 2010-11-11
3
Medium Priority
?
925 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
ioanton earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Experts give $3,000 toward hurricane relief efforts—but that's not all!
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 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