Solved

exception trying to convert String "4

Posted on 2004-04-19
3
1,027 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
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

808 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