Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL: Using c:if to test boolean after a login  RSS feed

 
eamonn dunne
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a little difficulty getting the c:if tag working.

The error that im getting is javax.servlet.jsp.el.ELException: Unable to find a value for "SuperRole" in object of class "focus.entitiy.bean.User" using operator "."

To explain what I'm doing, a regular jsp posts the username and password to my loginservlet which uses the following code:




That uses the method loginQuery which is below:


As you can see once the login is valid it dispatches the request to menu.jsp which has the following code:



and just incase the getter and setter from userbean


I would be extremely grateful for any help anyone could give me
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Welcome to Javaranch

public boolean getSuperRole() {
return superRole;
}

The setter and getter of boolean attribute "superRole" is not by Java bean standards. It has to use isSuperRole and setSuperRole to get and set respectively.

<c:if test="${user.getSuperRole}" >

And then call using the bean attribute name and not by getter method.



 
eamonn dunne
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dude, thank you so much!
 
Bauke Scholtz
Ranch Hand
Posts: 2458
 
eamonn dunne
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fair point, im a little embarrassed I didnt consider it myself. Will close other threads.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!