Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7600439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:54:36+00:00 2026-05-30T22:54:36+00:00

This is sorta’ a two-part question. I have a person object with a char

  • 0

This is sorta’ a two-part question.

I have a person object with a char attribute on it called “active”. Person has a getActive() method that returns a char as expected. In my JSTL EL, I have the following:

<c:if test="${person.active == '1'}">Active</c:if>

This never passes. My understanding is that quoted literals in JSTL are strings (regardless of single or double quote) and that the char type is being retained from the getActive call, so these two values are not equal when getActive() returns the character ‘1’.

As an alternative, I added an isActive() method which returns a boolean. In this case, the following works:

<c:if test="${person.active == true}">Active</c:if>

Here are my questions:

  1. Is my understanding correct regarding the char comparison? If so, is there any way to convert the types in JSTL so that they are comparable?
  2. When both getActive() and isActive() exist, which one gets called by the EL translation? It seems isActive() gets priority but is there an officially documented ordering to this?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:54:37+00:00Added an answer on May 30, 2026 at 10:54 pm

    Is my understanding correct regarding the char comparison? If so, is there any way to convert the types in JSTL so that they are comparable?

    From chapter 1.8.2 of EL 2.2 specification (emphasis mine):

    1.8.2       A {==,!=,eq,ne} B

    • If A==B, apply operator
    • If A is null or B is null return false for == or eq, true for != or ne.
    • If A or B is BigDecimal, coerce both A and B to BigDecimal and then:
      • If operator is == or eq, return A.equals(B)
      • If operator is != or ne, return !A.equals(B)
    • If A or B is Float or Double coerce both A and B to Double, apply operator
    • If A or B is BigInteger, coerce both A and B to BigInteger and then:
      • If operator is == or eq, return A.equals(B)
      • If operator is != or ne, return !A.equals(B)
    • If A or B is Byte, Short, Character, Integer, or Long coerce both A and B to Long, apply operator
    • If A or B is Boolean coerce both A and B to Boolean, apply operator
    • If A or B is an enum, coerce both A and B to enum, apply operator
    • If A or B is String coerce both A and B to String, compare lexically
    • Otherwise if an error occurs while calling A.equals(B), error
    • Otherwise, apply operator to result of A.equals(B)

    The char/Character is in EL thus coerced and evaluated as Long. That can never equal to a string literal of '1'.


    When both getActive() and isActive() exist, which one gets called by the EL translation? It seems isActive() gets priority but is there an officially documented ordering to this?

    From chapter 8.3.2 of Javabeans specification (emphasis mine):

    8.3.2 Boolean properties

    In addition, for boolean properties, we allow a getter method to match the pattern:

    public boolean is<PropertyName>();

    This “is<PropertyName>” method may be provided instead of a “get<PropertyName>” method, or it may be provided in addition to a “get<PropertyName>” method.

    In either case, if the “is<PropertyName>” method is present for a boolean property then we will use the “is<PropertyName>” method to read the property value.

    An example boolean property might be:

        public boolean isMarsupial();
        public void setMarsupial(boolean m);
    

    This, in combination with the point right after the emphasized point in the previously quoted chapter 1.8.2 of EL spec,

    • If A or B is Boolean coerce both A and B to Boolean, apply operator

    will give the isXxx() method precedence.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a XML org.w3c.dom.Document object. It looks sorta like this: <A> <B> <C/>
This question might belong on one of the other trilogies, but it sorta seemed
I originally started this question in another thread, but that thread was sorta, kinda
I have a sorta unique question. There is a web application which takes 5.57mbs
Hey guys, I have a website that has a url that looks sorta like
I've got a website which has a layout sorta like this: <html xml:lang=en xmlns=http://www.w3.org/1999/xhtml
I have a folder that looks like this sorta /optik |- shadow - auth.ini
I'm sorta at a loss to why this doesn't work considering I got it
I have this sort of format asp.net MVC View -> Service Layer -> Repository.
I asked this sort of question before ( Application fails to dynamically _re_load JavaScript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.