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 9069245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:22:43+00:00 2026-06-16T17:22:43+00:00

I have this JSP EL expression, which uses the >= comparator. On my development

  • 0

I have this JSP EL expression, which uses the >= comparator. On my development environment I get the result you would expect, namely that 2 >= 188 is false. However, on my staging and production servers apparently 2 >= 188 is true.

Here is the code:

</ul>
<p>curPage: ${param.curPage}<br/>
totalPages: ${param.totalPages}<br/>
totalPages - curPage: ${param.totalPages - param.curPage}<br/>
curPage gt totalPages: ${param.curPage >= param.totalPages}<br/>
<p>

On my development environment, I get output like this:

curPage: 2
totalPages: 68
totalPages - curPage: 66
curPage gt totalPages: false

On staging:

curPage: 2
totalPages: 181
totalPages - curPage: 179
curPage gt totalPages: true

My development environment is running Tomcat 7.0.29, staging is running 7.0.30. The codebases are the same.

The above code is in a file “pagination.jsp” (I know, it should be a .tag), which is included into another jsp like this:

<jsp:include page="/widgets/pagination.jsp">
    <jsp:param name="totalPages" value="${actionBean.jbp.totalPages}" />
    <jsp:param name="baseUrl" value="${baseUrl}" />
    <jsp:param name="curPage" value="${not empty param.page?param.page:0}" />
</jsp:include>

“jbp.totalPages” is defined as:

private final int totalPages;

and “param.page” is obviously a page parameter.

I suppose there could be a type conversion problem here, between the parameter and the int, but that does not explain why it works on one machine and not the other.

Also, I thought JSP EL did automatic type conversion.

Any thoughts would be appreciated.

  • 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-06-16T17:22:44+00:00Added an answer on June 16, 2026 at 5:22 pm

    Those params are evaluated as String instead of Number (because that’s basically what HttpServletRequest#getParameter() returns). A string value of "2" is lexicographically “greater” than any string value starting with "1".

    You need to parse them as Number. You can use JSTL <fmt:parseNumber> for this.

    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    ...
    <fmt:parseNumber var="curPage" value="${param.curPage}" integerOnly="true" />
    <fmt:parseNumber var="totalPages" value="${param.totalPages}" integerOnly="true" />
    ... 
    <p>
      curPage: ${curPage}<br/>
      totalPages: ${totalPages}<br/>
      totalPages - curPage: ${totalPages - curPage}<br/>
      curPage gt totalPages: ${curPage >= totalPages}<br/>
    </p>
    

    As to the difference in development versus production environment, this is most likely result of bad testing (not using same test data or maybe even not same test code). There is namely nothing like that changed in Tomcat’s EL implementation across the mentioned versions. Only if one of the hands in the comparison is really a Number and the other is a String, then EL will coerce the String to Long. This is perhaps what is happening in real code.

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

Sidebar

Related Questions

I have this jsp client that consumes a webservice. The problem with the client
I have a jsp page, which imports another jsp. This import is wrapped into
I'm running Tomcat 6.0.18 on Linux. I have a JSP that uses a bean
I have this JSP code snippet: <%@ taglib uri=http://java.sun.com/jsp/jstl/core prefix=c%> <c:choose> <c:when test=${var1.properties[\Item Type\]
I have this jQuery code in my JSP page (jQuery 1.7.2) : function Header()
I have this strange behavior in my JSP page: I have two Integer variables
i have this tag as input tag: <a href=controller.jsp?sid=127490C88DB5&R=35144 class=11-link-dkred-bold><b>Mr. John Q. Anderson&nbsp;&nbsp;&nbsp;MBA 1977
So I am pretty new to JSP. I have tried this a few ways.
Still learning JSP Web Applications here. I have been doing this for a while
I have a custom jsp tag like this: <a:customtag> The body of the custom

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.