Solved

exception trying to convert String "4

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

17 Experts available now in Live!

Get 1:1 Help Now