JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Servlet/JSP 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Re:[問題]即時多層下拉選單 [Re:minichitina]
eidson72





發文: 25
積分: 0
於 2007-05-16 11:48 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.sql.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<%
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
Connection Conn = DriverManager.getConnection("proxool.xml-test");

int i=0;
Statement stmt = Conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
Statement stmt2 = Conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
String SQL = "Select * from unit";
ResultSet rs = stmt.executeQuery(SQL);
%>

<SCRIPT LANGUAGE="javascript">
<!--
function ChangeSelect(city, region)
{
val = city.options[city.options.selectedIndex].value;

<%
while(rs.next())
{
String SQL2 = " select * from class where unit="+rs.getString("unit_id");
ResultSet rs2 = stmt2.executeQuery(SQL2);

%>
if (val == '<%=rs.getString("unit")%>')
{

<%while(rs2.next()){
i++;
}%>
region.length = <%=i%>;
<%
i=0;
rs2.first();
do{%>
region.options[<%=i%>].value = '<%=rs2.getString("class")%>';
region.options[<%=i%>].text = '<%=rs2.getString("class")%>';
<%
i++;
}while(rs2.next());
i=0;%>
}
<%}
rs.first();%>
}
-->
</script>

<form name="selection">
<select name=city onChange="ChangeSelect(document.selection.city,document.selection.region)" size="1">
<option>==請選擇城市==</option>
<%do{%>
<option value="<%=rs.getString("unit_id")%>"><%=rs.getString("unit")%></option>
<%}while(rs.next());%>
</select><BR>
選擇您要的區域</font><br>
<SELECT name=region>

</SELECT> </p>
</form>

</body>
</html>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
請教一下各位大大..我是初學者...我不知道我那邊有錯...><---下面是apache log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /sql/test.jsp:44

41: i=0;
42: rs2.first();
43: do{%>
44: region.options[<%=i%>].value = '<%=rs2.getString("class")%>';
45: region.options[<%=i%>].text = '<%=rs2.getString("class")%>';
46: <%
47: i++;

Stacktrace:
  org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: Illegal operation on empty result set.
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
  org.apache.jsp.sql.test_jsp._jspService(test_jsp.java:151)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.sql.SQLException: Illegal operation on empty result set.
  com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:4341)
  com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:2137)
  com.mysql.jdbc.ResultSet.getString(ResultSet.java:2132)
  com.mysql.jdbc.ResultSet.getString(ResultSet.java:2250)
  org.apache.jsp.sql.test_jsp._jspService(test_jsp.java:100)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
81188 [精華] [問題]即時多層下拉選單 ㄚ孝 384 2003-06-07 09:05
78359 Re:[問題]即時多層下拉選單 browser 1054 2003-06-07 18:19
75290 Re:[問題]即時多層下拉選單 x3711699 138 2004-04-08 20:41
75103 Re:[問題]即時多層下拉選單 alanting 710 2004-04-11 01:41
78338 Re:[問題]即時多層下拉選單 AdaHsu 3345 2004-04-19 12:23
76212 Re:[問題]即時多層下拉選單 tsechun 95 2004-04-21 02:01
73368 Re:[問題]即時多層下拉選單 andowson 474 2004-08-01 11:07
73095 Re:[問題]即時多層下拉選單 yingssu 663 2004-08-01 19:48
72170 Re:[問題]即時多層下拉選單 ting626 38 2004-08-25 16:57
72236 Re:[問題]即時多層下拉選單 i22616899 2298 2004-09-04 17:55
71424 Re:[問題]即時多層下拉選單 GuanChih 175 2004-09-05 18:51
72160 Re:[問題]即時多層下拉選單 jonz 873 2004-09-12 10:27
65412 Re:[問題]即時多層下拉選單 pulse 1193 2005-04-18 23:22
69217 Re:[問題]即時多層下拉選單 joshua 1019 2004-11-17 16:02
69541 Re:[問題]即時多層下拉選單 joshua 2357 2004-11-17 17:27
75805 Re:[問題]即時多層下拉選單 ㄚ孝 61 2003-06-09 08:34
76028 Re:[問題]即時多層下拉選單 browser 135 2003-06-09 09:23
68250 Re:[問題]即時多層下拉選單 Madagascar 141 2004-12-04 02:06
68062 Re:[問題]即時多層下拉選單 yannru 360 2004-12-07 16:19
67926 Re:[問題]即時多層下拉選單 Madagascar 465 2004-12-07 21:20
67920 Re:[問題]即時多層下拉選單 small3 388 2004-12-13 09:52
68303 Re:[問題]即時多層下拉選單 EPHT 3599 2004-12-18 09:45
55683 Re:[問題]即時多層下拉選單 yulie 2015 2006-06-06 12:47
55401 Re:[問題]即時多層下拉選單 yulie 102 2006-06-06 13:21
55675 Re:[問題]即時多層下拉選單 estrelas 1620 2006-06-06 18:51
46468 Re:[問題]即時多層下拉選單 minichitina 1875 2007-05-05 16:25
46362 Re:[問題]即時多層下拉選單 eidson72 4781 2007-05-16 11:48
21257 Re:[問題]即時多層下拉選單 catte 1960 2011-06-27 14:44
21148 Re:[問題]即時多層下拉選單 bernardvai 54 2011-06-27 16:56
45940 Re:[問題]即時多層下拉選單 alvin0224 309 2007-05-16 14:54
46018 Re:[問題]即時多層下拉選單 eidson72 21 2007-05-16 15:41
75619 Re:[問題]即時多層下拉選單 ㄚ孝 75 2003-06-09 14:05
75580 Re:[問題]即時多層下拉選單 jackyliu 201 2003-06-22 02:06
45470 Re:[問題]即時多層下拉選單 minichitina 188 2007-05-31 08:33
45332 Re:[問題]即時多層下拉選單 minichitina 2335 2007-06-04 08:04
45801 Re:[問題]即時多層下拉選單 minichitina 2718 2007-06-07 08:00
21259 Re:[問題]即時多層下拉選單 catte 2014 2011-06-28 03:14
21111 Re:[問題]即時多層下拉選單 bernardvai 1202 2011-06-28 09:54
21223 Re:[問題]即時多層下拉選單 catte 2970 2011-06-28 11:36
21086 Re:[問題]即時多層下拉選單 bernardvai 545 2011-06-28 14:21
21175 Re:[問題]即時多層下拉選單 catte 146 2011-06-28 17:54
21100 Re:[問題]即時多層下拉選單 bernardvai 2904 2011-06-29 09:58
21052 Re:[問題]即時多層下拉選單 catte 43 2011-06-29 21:58
20938 Re:[問題]即時多層下拉選單 bernardvai 219 2011-06-30 14:40
20750 Re:[問題]即時多層下拉選單 catte 269 2011-07-13 10:41
20829 Re:[問題]即時多層下拉選單 bernardvai 660 2011-07-13 11:34
20247 Re:[問題]即時多層下拉選單 catte 4035 2011-08-15 09:35
20475 Re:[問題]即時多層下拉選單 jk47 288 2011-08-15 11:19
75554 Re:[問題]即時多層下拉選單 mousetail 89 2003-06-22 13:06
77188 Re:[問題]即時多層下拉選單 alanting 1777 2003-06-22 23:21
75716 Re:[問題]即時多層下拉選單 alanting 87 2003-06-22 23:24
21374 Re:[問題]即時多層下拉選單 catte 54 2011-06-27 04:33
75132 Re:[問題]即時多層下拉選單 evenlin 132 2003-08-02 00:55
77279 Re:[問題]即時多層下拉選單 anthonycs 301 2003-08-02 15:43
74768 Re:[問題]即時多層下拉選單 ajax0953 232 2004-03-31 15:05
74514 Re:[問題]即時多層下拉選單 shyan68 261 2004-04-07 18:11
72958 Re:[問題]即時多層下拉選單 yafeng 122 2004-07-29 10:53
68398 Re:[問題]即時多層下拉選單 javaer 216 2004-12-20 00:40
» JWorld@TW »  Servlet/JSP 討論區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8