[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

06/05/2006 at 05:56AM PDT, ID: 21874698
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

JSP Coercion Error

Asked by Caydel in Java Server Pages (JSP)

Tags: coerce, attempt, value

Hello. I am developing an app for my employer, and I am encountering an error due to coercion somewhere in one of my pages. I am having trouble locating it. I hope someone can provide me with a bit of assistance.

exception
 
javax.servlet.ServletException: Attempt to coerce a boolean value "false" to type "java.lang.Long"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
      org.apache.jsp.jsp.process_jsp._jspService(process_jsp.java:2207)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
root cause
 
javax.servlet.jsp.el.ELException: Attempt to coerce a boolean value "false" to type "java.lang.Long"
      org.apache.commons.el.Logger.logError(Logger.java:481)
      org.apache.commons.el.Logger.logError(Logger.java:498)
      org.apache.commons.el.Logger.logError(Logger.java:566)
      org.apache.commons.el.Coercions.coerceToPrimitiveNumber(Coercions.java:422)
      org.apache.commons.el.Coercions.applyArithmeticOperator(Coercions.java:872)
      org.apache.commons.el.ArithmeticOperator.apply(ArithmeticOperator.java:83)
      org.apache.commons.el.BinaryOperatorExpression.evaluate(BinaryOperatorExpression.java:170)
      org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
      org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190)
      org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:899)
      org.apache.jsp.jsp.process_jsp._jspx_meth_c_if_97(process_jsp.java:20735)
      org.apache.jsp.jsp.process_jsp._jspService(process_jsp.java:2100)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.



The code which causes it is:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%!String firstname;
 
      String lastname;
 
      %>
 
 
<%-- Check for valid session --%>
<c:if test="${validUser == null}">
      <jsp:forward page="../login.jsp">
            <jsp:param name="error" value="4" />
      </jsp:forward>
</c:if>
 
<%-- ****************Address Stuff  *********** --%>
 
<%-- Check if address/location exists --%>
 
<sql:query var="add_exists">
      SELECT
            *
      FROM
            address_table
      WHERE
            (address_1 = ?)
            
      <sql:param value="${param.add_1}" />
</sql:query>
 
<%-- if a record is returned, get the address id --%>
 
<c:if test="${add_exists.rowCount == 1}">
      <c:forEach items="${add_exists.rows}" var="add_row">
            <c:set var="add_id" value="${add_row.add_id}" />
      </c:forEach>
</c:if>
 
 
<%-- If 1 record is not returned from query, add the address--%>
<c:if test="${add_exists.rowCount != 1}">
      <sql:update var="insert_address">INSERT INTO address_table VALUES ( 0, ?, ?, ?, ?, ?, ?, ?, ? )
                  
            <sql:param value="${param.Company}" />
            <sql:param value="${param.Store_num}" />
            <sql:param value="${param.add_1}" />
            <sql:param value="${param.add_2}" />
            <sql:param value="${param.city}" />
            <sql:param value="${param.province}" />
            <sql:param value="${param.country}" />
            <sql:param value="${param.phone}" />
      </sql:update>
 
      <%--now get the address id.... --%>
 
      <sql:query var="add_exists">
                  SELECT
                        add_id
                  FROM
                        address_table
                  WHERE
                        (address_1 = ?)
            
            <sql:param value="${param.add_1}" />
      </sql:query>
 
      <c:forEach items="${add_exists.rows}" var="row">
            <c:set var="add_id" value="${row.add_id}" />
      </c:forEach>
</c:if>
 
 
<%-- ************  check if crew member1 exists, and get id# ****************--%>
<c:if test="${not empty param.Crew1_name}">
      <c:out value="testing to see if c1 exists " />
 
      <sql:query var="crew1_exists">
                        SELECT
                              *
                        FROM
                              crew_map
                        WHERE
                              (last_name = ?) AND (first_name = ?)
                      
            <sql:param
                  value='<%= com.acps.takedown.NameParserBean.parseLastname(request
                                    .getParameter("Crew1_name")) %>' />
            <sql:param
                  value='<%= com.acps.takedown.NameParserBean.parseFirstname(request
                        .getParameter("Crew1_name")) %>' />
      </sql:query>
 
      <c:if test="${crew1_exists.rowCount == 1}">
            <c:forEach items="${crew1_exists.rows}" var="crew1_row">
                  <c:set var="c1id" value="${crew1_row.person_id}" />
            </c:forEach>
      </c:if>
 
 
      <%-- if not, add him --%>
 
      <c:if test="${crew1_exists.rowCount != 1}">
            <c:out value="c1 does not exist, adding him" />
            <sql:update var="add_crew1">
                              INSERT INTO crew_map VALUES
                              (0, ?, ? )
            
                  <sql:param
                        value='<%= com.acps.takedown.NameParserBean.parseLastname(request
                                    .getParameter("Crew1_name")) %>' />
                  <sql:param
                        value='<%= com.acps.takedown.NameParserBean.parseFirstname(request
                        .getParameter("Crew1_name")) %>' />
            </sql:update>
 
            <%-- and then get the id --%>
            <sql:query var="crew1_get_id">
                        SELECT
                              *
                        FROM
                              crew_map
                        WHERE
                              (last_name = ?) AND (first_name = ?)
                      <sql:param
                        value='<%= com.acps.takedown.NameParserBean.parseLastname(request
                                    .getParameter("Crew1_name")) %>' />
                  <sql:param
                        value='<%= com.acps.takedown.NameParserBean.parseFirstname(request
                        .getParameter("Crew1_name")) %>' />
            </sql:query>
            <c:forEach items="${crew1_get_id.rows}" var="crew1_row">
                  <c:set var="c1id" value="${crew1_row.person_id}" />
            </c:forEach>
      </c:if>
</c:if>
 
 
<sql:update var="insert_job">INSERT INTO job_table VALUES ( 0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?  )
                  
      <sql:param value="${param.Date}" />
      <sql:param value="${add_id}" />
      <sql:param value="${c1id}" />
      <sql:param value="${c2id}" />
      <sql:param value="${c3id}" />
      <sql:param value="${c4id}" />
      <sql:param value="${c5id}" />
      <sql:param value="${c6id}" />
      <sql:param value="${param.travel_time}" />
      <sql:param value="${param.start_time}" />
      <sql:param value="${param.end_time}" />
      <sql:param value="${param.delay_time}" />
      <sql:param value="${param.Comments}" />
</sql:update>
 
<sql:query var="job_id_check">
      SELECT max(job_id) AS max_job_id FROM job_table
</sql:query>
 
<c:forEach items="${job_id_check.rows}" var="job_row">
      <c:set var="job_id" value="${job_row.max_job_id}" />
</c:forEach>



Thank you for any and all help/suggestions/ideas. It is really appreciated!
[+][-]06/05/06 11:42 AM, ID: 16835658

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Server Pages (JSP)
Tags: coerce, attempt, value
Sign Up Now!
Solution Provided By: bloodredsun
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06/28/06 02:55 AM, ID: 16999734

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07/02/06 02:39 PM, ID: 17027845

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74