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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:44:08+00:00 2026-06-18T10:44:08+00:00

I am attempting to send two attributes to a JSP via a Java HttpServlet.

  • 0

I am attempting to send two attributes to a JSP via a Java HttpServlet. The problem is they are both appearing as 0 (the number) in my JSP file.

Here is the doGet method in my RegisterDeveloper.java file:

public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // Fill up default attributes for the template
        req.setAttribute("validation-error", false);
        req.setAttribute("validation-error-message", "");

        // Redirect to register page
        req.getRequestDispatcher("/register.jsp").forward(req, resp);
}

Very simple and when I step through the attributes are added to the request and the browser is redirected to the /register.jsp page.

Here is the problem part of the register.jsp page:

<c:if test="${validation-error}">
    <div id="validationError">
        <span id="errorText">
            ${validation-error-message}
        </span>
    </div>
</c:if>

For some reason the attributes I added to the request have all become ‘0’.

The error displayed in the browser is:

HTTP Status 500 - javax.el.ELException: Cannot convert 0 of type class java.lang.Long to class java.lang.Boolean

My web.xml incase it’s relevant:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">

    <display-name>RServer</display-name>
    <welcome-file-list>
        <welcome-file>homepage.html</welcome-file>
    </welcome-file-list>

    <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.css</url-pattern>
    </servlet-mapping>

    <servlet>
        <servlet-name>RegisterDeveloper</servlet-name>
        <servlet-class>com.steven.RegisterDeveloper</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>RegisterDeveloper</servlet-name>
        <url-pattern>/register</url-pattern>
    </servlet-mapping>

</web-app>

I’m using Tomcat6. This all seems very straight forward, and I have very similar code working on other pages, so I’m really struggling to see what I’ve missed!

Any help, very much appreciated.

I have javax.servlet.jsp.jstl-1.2.1.jar and javax.servlet.jsp.jstl-api-1.2.1.jar in my /WEB-INF/lib/ folder..

  • 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-18T10:44:09+00:00Added an answer on June 18, 2026 at 10:44 am

    From a specification I googled

    An identifier is constrained to be a Java identifier – e.g., no -, no /, etc.

    validation-error is not a Java identifier, but a subtraction operation for validation
    and error. Since you have not defined those, they are null and this applies:

    1.7.1 Binary operators – A {+,-,*} B ■ If A and B are null, return (Long)0

    So I guess the test becomes if( (Long)0 == true ).

    Try with req.setAttribute("validationError", false); ${validationError}

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

Sidebar

Related Questions

I have a problem when attempting to serialize class on a server, send it
I'm attempting to send MMS implementing the method outlined here: How to send image
I'm getting a java.lang.IllegalArgumentException exception when attempting to send a message to the GCM
I'm attempting to send a file to the browser that is located on a
I am attempting to send a message via sockets from VBA. I have made
I'm attempting to send HTML formatted emails using C# 3 via Outlook.MailItem Outlook.MailItem objMail
I am attempting to send some data via JSON to a MVC controller action:
I'm attempting to send an email using the CakePHP SwiftMailer component I found here:
I am attempting to send POST data using urllib, but the problem is normally
I am attempting to send Base64 image data via ajax to Server. Sometimes all

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.