jsp页面,我想通过数据库中查出的值显示相应的DIV,运行时显示结果集为空。
workflow.jsp页面代码<scripttype="text/javascript">functiontest(){Stringsq_name=request.ge...
workflow.jsp页面代码
<script type="text/javascript">
function test(){
String sq_name=request.getParameter("sq_name");
ResultSet rs1=inBean.ExeQuery("select * from sq_user,work_flow where sq_user.work_name=work_flow.work_name and sq_name='"+sq_name+"'");
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='none';
document.getElementById('d').style.display='none';
document.getElementById('e').style.display='none';
var order=rs1.getString("work_order"); //work_order里的值为a到e,与div的id相对应。
document.getElementById(order).style.display='block';
}
</script>
<form name="myform" action="workflow.jsp" method="post">
<span>申请人</span>
<input name="sq_name" id="sq_name" type="text" size="15">
<input name="Submit" type="button" class="button" id="Submit" value="查询" onclick="return test()">
</form>
<div id="a" style="display:none"><img src="newpic/1.gif" /></div>
<div id="b" style="display:none"><img src="newpic/2.gif" /></div>
<div id="c" style="display:none"><img src="newpic/3.gif" /></div>
<div id="d" style="display:none"><img src="newpic/4.gif" /></div>
<div id="e" style="display:none"><img src="newpic/5.gif" /></div>
输入名字(sq_name)后,点击查询,在数据库结果集里根据该用户的work_order值显示相应的DIV。
myeclipse显示结果集为空:Illegal operation on empty result set。请问怎么调整? 展开
<script type="text/javascript">
function test(){
String sq_name=request.getParameter("sq_name");
ResultSet rs1=inBean.ExeQuery("select * from sq_user,work_flow where sq_user.work_name=work_flow.work_name and sq_name='"+sq_name+"'");
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='none';
document.getElementById('d').style.display='none';
document.getElementById('e').style.display='none';
var order=rs1.getString("work_order"); //work_order里的值为a到e,与div的id相对应。
document.getElementById(order).style.display='block';
}
</script>
<form name="myform" action="workflow.jsp" method="post">
<span>申请人</span>
<input name="sq_name" id="sq_name" type="text" size="15">
<input name="Submit" type="button" class="button" id="Submit" value="查询" onclick="return test()">
</form>
<div id="a" style="display:none"><img src="newpic/1.gif" /></div>
<div id="b" style="display:none"><img src="newpic/2.gif" /></div>
<div id="c" style="display:none"><img src="newpic/3.gif" /></div>
<div id="d" style="display:none"><img src="newpic/4.gif" /></div>
<div id="e" style="display:none"><img src="newpic/5.gif" /></div>
输入名字(sq_name)后,点击查询,在数据库结果集里根据该用户的work_order值显示相应的DIV。
myeclipse显示结果集为空:Illegal operation on empty result set。请问怎么调整? 展开
展开全部
ResultSet rs1=inBean.ExeQuery("select * from sq_user,work_flow where sq_user.work_name=work_flow.work_name and sq_name='"+sq_name+"'");
if(rs1.next()){
……
}
追问
还是不行~
追答
其实我觉得你在jsp界面用java ,怎么也要用<%%>吧?
<script type="text/javascript">
function test(){
<%
String sq_name=request.getParameter("sq_name");
ResultSet rs1=inBean.ExeQuery("select * from sq_user,work_flow where sq_user.work_name=work_flow.work_name and sq_name='"+sq_name+"'");
if(rs1.next()){
%>
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='none';
document.getElementById('d').style.display='none';
document.getElementById('e').style.display='none';
var order=rs1.getString("work_order"); //work_order里的值为a到e,与div的id相对应。
document.getElementById(order).style.display='block';
<% } %>
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询