I am trying to send two attributes to JSP via Java HttpServlet. The problem is that they both appear as 0 (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 {
req.setAttribute("validation-error", false);
req.setAttribute("validation-error-message", "");
req.getRequestDispatcher("/register.jsp").forward(req, resp);
}
Very simple, and when I go through the attributes, they are added to the request, and the browser is redirected to the /register.jsp page.
Here is part of the problem on 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 that I added to the request became "0".
Error displayed in browser:
HTTP Status 500 - javax.el.ELException: Cannot convert 0 of type class java.lang.Long to class java.lang.Boolean
My web.xml will make it 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 am using Tomcat6. It all seems very straightforward, and I have very similar code working on other pages, so I'm really trying to figure out what I missed!
Any help is greatly appreciated.
javax.servlet.jsp.jstl-1.2.1.jar javax.servlet.jsp.jstl-api-1.2.1.jar /WEB-INF/lib/.