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
Solved

How to access a boolean value on a object using JSTL

Posted on 2010-11-11
3
906 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
getting Http 404 error in jsp forms 8 81
servlet cookie finding by name 1 84
difference between projection and projection list in hibernate 1 120
servlet example 17 51
Businesses who process credit card payments have to adhere to PCI Compliance standards. Here’s why that’s important.
This article describes how to reset your Windows 10 password when you've forgotten it.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

792 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