Solved

exception trying to convert String "4

Posted on 2004-04-19
3
1,028 Views
Last Modified: 2007-12-19
Hi,
I could swear that this used to work but I've taken too long of a break from coding... Here is the code:
<c:set var="IDforProject" value="0" />

<%-- Check to see if project in cbo --%>
<c:if test="${param.cboProject != 0}" >
  <%-- IDforProject is the value for the cbo entry --%>
  <c:set var="IDforProject" value="${param.cboProject}" />
</c:if>

cboProject is a select on a from in aiNew (please excuse my VB roots ;)

And here is the error message from Tomcat 4.1.27:

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${param.cboProject != 0}": An exception occured trying to convert String "4              
                        " to type "java.lang.Long" (null)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:430)
at org.apache.jsp.aiNew_jsp._jspx_meth_c_if_4(aiNew_jsp.java:580)
at org.apache.jsp.aiNew_jsp._jspx_meth_c_if_0(aiNew_jsp.java:427)
at org.apache.jsp.aiNew_jsp._jspService(aiNew_jsp.java:87)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
.....

I thought that JSTL would take care of converting the string "4" to allow a numeric comparison automatically?  My code is full of these kinds of tests so something must have changed but not sure what.  Also, the error message points to aiNew.jsp, but the error is really occuring in aiRequestNewProc.jsp as a result of <jsp:forward page="aiRequestNewProc.jsp" />.

Thanks,
Eric
0
Comment
Question by:EricE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 200 total points
ID: 10866426
Sounds like ${param.cboProject} has a CR or LF in it...ie:  

param.cboProject = "4\n" ;

try trim() ing the value before you set it up, or try to avoid putting the \n in...

Tim
0
 

Author Comment

by:EricE
ID: 10875229
Hi,
Bingo, sometimes when I go back and forth between Dreamweaver and Ultraedit, Dreamweaver does some funny things with the line returns.

Thanks,
Eric
0
 
LVL 35

Expert Comment

by:TimYates
ID: 10875852
:-)  Glad I could help! :-)

Good luck with it!!

Tim
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lamba in java 8 9 253
java cigar challenge 58 214
Looking for some programs to resell or buy source codes 1 78
Using Tomcat as raspberry pi java app server 13 228
Building a cohesive image for your brand is vital to making an impression on consumers. When the economy is tough, brands do better than unbranded  products. This can have a huge impact on your long-term profits, as the economy goes up and down.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question