?
Solved

exception trying to convert String "4

Posted on 2004-04-19
3
Medium Priority
?
1,031 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 800 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

764 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