2013-04-08 49 views
0

試圖執行serachpage.jsp,它可以在搜索id的基礎上搜索數據庫中的數據。基本上我在select語句後得到一個錯誤。無法在jsp中執行搜索頁面

代碼:

<% 

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"); 
    } 

%> 

錯誤:

An error occurred at line: [108] in the generated java file: [D:\mohit\apache-tomcat-7.0.37\work\Catalina\localhost_\org\‌​apache\jsp\serachisue_jsp.java]
Syntax error, insert "Finally" to complete TryStatement
An error occurred at line: [109] in the generated java file: [D:\mohit\apache-tomcat-7.0.37\work\Catalina\localhost_\org\‌​apache\jsp\serachisue_jsp.java]
Syntax error, insert "}" to complete ClassBody

+0

請把它當作迫切要求,如果有人可以幫助我作爲最早爲可能我會非常感謝他/她 – 2013-04-08 04:49:31

+0

你可以添加堆棧跟蹤嗎? – shola 2013-04-08 05:13:53

+0

@shola我沒有任何堆棧跟蹤將只提供catalina日誌,因爲這個本地桌面應用程序。 – 2013-04-08 05:21:35

回答

1

}架失蹤try塊:

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(); 
} 
+0

你試過這個嗎? – shola 2013-04-08 06:04:15

+0

需要關閉這一個<%??? – 2013-04-08 06:22:38

+0

在運行search.jsp程序後得到錯誤java.lang.NumberFormatException:null java.lang.Integer.parseInt(Integer.java:417) (java.lang.Integer.parseInt(Integer.java:499))中的錯誤 在org.apache.jsp.serachissue_jsp._jspService(serachissue_jsp.java:83) 在org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 在javax.servlet.http.HttpServlet.service( HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) – 2013-04-08 06:29:22