Solved

exception trying to convert String "4

Posted on 2004-04-19
3
1,025 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
logging jar 1 106
String format issue 13 90
Can't access image with tomcat/html 6 95
difference between projection and projection list in hibernate 1 101
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now