尝试执行serachpage.jsp,它可以在搜索ID的基础上搜索数据库中的数据。基本上我在select语句后出错了。
代码:
<%
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]
语法错误,插入“最后”以完成TryStatement
生成的java文件中的行:[109]发生错误:[D:\ mohit \ apache-tomcat-7.0.37 \ work \ Catalina \ localhost_ \ org \ apache \ jsp \ serachisue_jsp.java]
语法错误,插入“}”以完成ClassBody
答案 0 :(得分: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();
}