int ID=Integer.parseInt(request.getParameter("ID")); 报错
报500错误,错误信息如下
type Exception report
message An exception occurred processing JSP page /bbs_detail.jsp at line 10
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /bbs_detail.jsp at line 10
7: connDB conn=new connDB();
8: String username=(String)session.getAttribute("username");
9: int ID=-1;
10: ID=Integer.parseInt(request.getParameter("ID"));
11: if(ID>0){
12: ResultSet rs=conn.executeQuery("select * from tb_BBS where ID="+ID);
13: String Title="";
源码是:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.wgh.DB.connDB" %>
<%@ page import="com.wgh.DB.chStr" %>
<%@ page import="java.lang.NumberFormatException" %>
<%
chStr chStr=new chStr();
connDB conn=new connDB();
String username=(String)session.getAttribute("username");
int ID=-1;
ID=Integer.parseInt(request.getParameter("ID"));
if(ID>0){
ResultSet rs=conn.executeQuery("select * from tb_BBS where ID="+ID);
String Title="";
String content="";
String Intime="";
if(rs.next()){
Title=rs.getString(2);
content=rs.getString(3);
Intime=rs.getString(4);
}
%>