Solved

How to access a boolean value on a object using JSTL

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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