求大神解决前台查询输出问题
<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.sql.*"%>
<html>
<head>
<script type="text/javascript">
function search(){
var isSea=confirm("确定要查找信息吗?");
if(!isSea)
return false;
}
</script>
<style type="text/css">
table,tr,td{
border:1px solid black;
border-collapse:collapse;
text-align:left;
}
</style>
</head>
<body>
<h3>项目信息查询(PROJECT)</h3>
<form action="test.jsp" method=post name=fm><p><b>PROJ_ID</b><input type="text" id="pro_id" name="fuck" />
<b>PROJ_SHORT_NAME</b><input type="text" id="p_s_name" name=fucku />
<input type="submit" name=sumbit1 value="查询" />
</form>
<table>
<tr>
<td>PROJ_ID</td>
<td>PROJ_SHORT_NAME</td>
<td>LAST_SCHEDULE_DATE</td>
<td>SUM_DATA_DATE</td>
</tr>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
String url="jdbc:oracle:thin:@10.88.51.238:1521:ORCL";
//orcl为你的数据库的SID
String username="admuser";
String password="abcd1234";
Connection conn = DriverManager.getConnection(url,username,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);//可更新
//int proid=request.getParameter("fuck");
//String proname=request.getParameter("fucku");
String sql="select PROJ_ID,PROJ_SHORT_NAME,LAST_SCHEDULE_DATE,SUM_DATA_DATE FROM PROJECT where PROJ_ID='"+fuck+"' and PROJ_SHORT_NAME='"+fucku+"'";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){
%>
<tr>
<td><%=rs.getInt("PROJ_ID")%></td>
<td><%=rs.getString("PROJ_SHORT_NAME")%></td>
<td><%=rs.getString("LAST_SCHEDULE_DATE")%></td>
<td><%=rs.getString("SUM_DATA_DATE")%></td>
</tr>
<%
}
%>
<%
rs.close();
stmt.close();
conn.close();
}catch(Exception e){
e.printStackTrace();
}
%>
</table>
</body>
</html>
我要实现前台的数据查询操作并显示结果,现在无论怎么调都显示“无效数据”的错误,我把“proid”改为int型又提示“cannot convert from String to int”,我该怎么改???求大神赐教
------解决方案-------------------- rs.close();
stmt.close();
conn.close();
你关闭的时候,顺序错了。
------解决方案--------------------Java code
//楼主把这两个值打印一下。
String proid=request.getParameter("fuck");
String proname=request.getParameter("fucku");
------解决方案--------------------
你数据库PROJ_ID类型是数字型的?
Java code
int proid=request.getParameter("fuck");
S