Ok, you hav eto check a few things, first, how do you send the parameter to the page? POST or GET (default).
You cannot just comment the checks for null value (since it can be in a class or something) without comment the whole block. The easiest way should be to set a false && in the start of you if case...
like if(false && no != null && ...)
this way, it will never go into that codeblock...
 
But since you have tested some, you might dont this (or a similar way) and then you know that the problem isn't in just that codeblock.
 
Have you tried (as a wrote before) to just take the no part? excuding the sql statement and mysql driver a.s.o. ?
here is how I locates error if i can't find them
 
1) Start with all the code (you get the error)
2) By the errormessage, guess where the error can be
3) Try to set the variable in the code (not to make it dynamic) so you know that it will work (test the sql statement sepratly also) Try setting all variables that can be involved with the problem
4) Start cut pieces of you code out and lay it in a notepad window (NOTE: Do a backup of the source before or something so if your computer crashes, you can restore it)
5) Compile and test.... still same error? Go back to 4 and remove some more code, do step 5 again
6) now you have located a part of the code where the error probably is, and it shouldn't be hard to figure out how to fix it (unless there is a hardware or configuration error in another program, but as log it is a code-error)
 
This method takes some time and I only use it when I can't figure out what and where the problem is. When you find where the problem is and donät know what to do, you know exacly what to ask someone, knowing that it is the specific line that causes the error
 
Since you get a error when you compile (what I can see) the problem may lie in you apache config. I'm not good at all in configuring apache but many others on the JSP-list seems to have a good hang of it.
 
Hope I helped some
 
// Jan
-----Ursprungligt meddelande-----
Från: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]För yilmaz
Skickat: den 19 oktober 2001 09:11
Till: [EMAIL PROTECTED]
Ämne: Re: help me with this " numberformat exception" please

Hi Jan,
----- Original Message -----
From: Jan Areno
Sent: Friday, October 19, 2001 2:07 PM
Subject: SV: help me with this " numberformat exception" please

You have the answer right there... check where it does a Integer.parseInt   (line 414 and/or 463)
 
the strange thing is ,in my code there is no Integer.parseInt() method, but i guess somewhere in the code jsp automatically calls that method.  
java.lang.NumberFormatException: mysql
        at java.lang.Integer.parseInt(Integer.java:414)
        at java.lang.Integer.parseInt(Integer.java:463)
 
If you want to check no, just use the first part of your code :
 
Class.forName("org.gjt.mm.mysql.Driver");
     String no=request.getParameter("no");  
     no=no.trim();
 if ((no!=null) && (no.length()!=0)){
 out.println("the value of no : "+ no);
}
 
The thing when you are looking for errors are to check a part of the code at the time, by doing that you can minimize your search area very fast. (There is an sort-algorithm that is base on the principle to cut everything in half...)
 
Note that no.trim() does return a null-pointer exception if it were null, so that means that you have a value in no (if the error isn't before that)
  it seems that the exception is thrown at the very beginning of the program, because even if i comment the code part where it checks for a null value , like
 
// if ((no!=null) && (no.length()!=0)){
still there is no change and the following out.println is not displayed.

 out.println("the value of no : "+ no);
 
 
in my opinion it can't receive the parameter for some unknown reasons ????
but still i can't find a solution for this strange problem.
i ma looking forward to your help. Thanks
 
 
 

 
 
-----Ursprungligt meddelande-----
Från: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]För yilmaz
Skickat: den 19 oktober 2001 04:46
Till: [EMAIL PROTECTED]
Ämne: Re: help me with this " numberformat exception" please

Thank you David, Horwat and Sankar for your help,
my JSP just can't see the parameters.
i tried calling the jsp without any parameter ( http://localhost:8080/newscont.jsp) and
i get the same numberformat exception, i think it can't even see that
there is a parameter at the end of  the url. What can be wrong ?
according to your advices i changed my code as follows :
 <%
 
     Class.forName("org.gjt.mm.mysql.Driver");
     String no=request.getParameter("no");  /*  i also tried with int no=request.getParameter("no"/no) didn't  work either  */
     no=no.trim();
 if ((no!=null) && (no.length()!=0)){
 out.println("the value of no : "+ no);
 try {
 
   conn = DriverManager.getConnection("jdbc:mysql:///yilmaz");
 
  String sql="select ndate,subject,news from new where no="+no;
     stmt = conn.createStatement (sql);
   out.println("sql string is :" + sql);
    rs = stmt.executeQuery (); .....it goes on...
 
still i am having this error : Any idea ??? (:(-
org.apache.jasper.JasperException: Unable to compile class for JSP
        at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:543)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:458)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2314)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1000)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1093)
        at java.lang.Thread.run(Thread.java:484)

Root Cause:

java.lang.NumberFormatException: mysql
        at java.lang.Integer.parseInt(Integer.java:414)
        at java.lang.Integer.parseInt(Integer.java:463)
        at org.apache.jasper.compiler.Compiler.getJspLineErrors(Compiler.java:321)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:280)
        at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:528)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:458)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2314)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
        at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1000)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1093)
        at java.lang.Thread.run(Thread.java:484)
 

Reply via email to