0

尝试执行 serachpage.jsp,它可以根据搜索 ID 从数据库中搜索数据。基本上我在选择语句后收到错误。

代码:

<%

try {
    String value = request.getParameter("Issue_ID");
    int Issue_ID=Integer.parseInt(value);
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/report_tracking","root", "root");
    Statement st = conn.createStatement();
    ResultSet rs = st.executeQuery("select * from issue_creating where Issue_ID='"+Issue_ID+"'");
    if(rs.next()) {         
        rs.getString("Problem_Submit");  
        rs.getString("Problem_Submit"); 
        rs.getString("Problem_Descr"); 
    }

%>

错误:

生成的java文件中的[108]行出现错误:[D:\mohit\apache-tomcat-7.0.37\work\Catalina\localhost_\org\‌​apache\jsp\serachisue_jsp.java]
语法错误,插入“Finally”完成TryStatement
生成的java文件中的[109]行发生错误:[D:\mohit\apache-tomcat-7.0.37\work\Catalina\localhost_\org\‌​apache\jsp\ serachisue_jsp.java]
语法错误,插入“}”完成ClassBody

4

1 回答 1

1

尝试块缺少括号:

try { 
    String value = request.getParameter("Issue_ID"); int  Issue_ID = Integer.parseInt(value);
    Class.forName("com.mysql.jdbc.Driver").newInstance(); 
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/report_tracking","root", "root"); 
    Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select * from issue_creating where Issue_ID='"+Issue_ID+"'");     
    if(rs.next()) {
        rs.getString("Problem_Submit");
        rs.getString("Problem_Submit"); 
        rs.getString("Problem_Descr"); 
    }
} 
catch(Exception e) {
   e.printStackTrace();
}
于 2013-04-08T05:33:43.583 回答