Also when comparing String objects use the appropriate methods, otherwise you will run in trouble..., you can't compare objects with ==...
if ((request.getParameter("no")!=null)&& (request.getParameter("no")!="")){ instead use String myNo = request.getParameter("no"); if ((myNo!=null)&& (myNo.equalsIgnoreCase(""))){ Xavier, Original Message ----------------------- hi everybody, i spent my whole afternoon with a stupid numberformat exception. at last i gave up,and decided to bring here. can someone help me with this please, or I will get crazy. i am using tomcat 4 on windows 2000. this jsp file takes a request parameter no, which is an integer. but it seems that it can't receive or read this parameter correctly. i call this jsp from my from browser as : http://localhost:8080/new/newscont.jsp?no=1 but i always have the same exception ( numberformat exception) below is my code: <%@ page language="java" contentType="text/html; charset=BIG5" %> <%@ page import="java.sql.*,java.util.*,org.gjt.mm.mysql.*" %> <HTML><HEAD><TITLE>NEWS</TITLE> <META content="text/html; charset=big5" http-equiv=Content-Type> </HEAD> <BODY bgColor=pink leftMargin=0 text=#000000 topMargin=0 marginheight='0' marginwidth='0'><BR> <%! Connection conn; String ndate,subject,news; int no; Statement stmt; ResultSet rs; String sql; %> <% Class.forName("org.gjt.mm.mysql.Driver"); if ((request.getParameter("no")!=null)&& (request.getParameter("no")!="")){ try { conn = DriverManager.getConnection("jdbc:mysql:///yilmaz"); no=Integer.parseInt(request.getParameter("no")); sql="select ndate,subject,news from new"+no; stmt = conn.createStatement (sql); rs = stmt.executeQuery (); while (rs.next() ) { ndate=rs.getString(1); out.println(ndate); subject=rs.getString(2); out.println(subject); news=rs.getString(3); out.println(news); } } catch (SQLException e) { out.println("SQLException caught "+ e.getMessage()); e.printStackTrace(); } catch (NumberFormatException nfe) { out.println("NumberFormatException caught "+nfe.getMessage()); } finally { rs.close(); stmt.close(); conn.close(); } } %> **************************************************** the whole other followings are normal html code **************************************************** when i run my JSP it throws : org.apache.jasper.JasperException: Unable to compile class for JSP ... root cause : java.lang.NumberFormatException: mysql at java.lang.Integer.parseInt(Integer.java:414) at java.lang.Integer.parseInt(Integer.java:463) ... ******************************** I AM LOOKING FORWARD TO YOUR HELP OR SUGGESTIONS THANKS A LOT IN ADVANCE =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com