1
我有一个JSP文件中的以下代码:<a>标签在HTML
rs=stmt.executeQuery("select * from routemaster");
if(rs!=null){
%>
<table class="notebook" align="center">
<tr class=row_title>
<th class=row_title>RouteID</th>
<th class=row_title>RouteCode</th>
<th class=row_title>BusNo</th>
<th class=row_title>InBoundTime</th>
<th class=row_title>OutBoundtime</th>
<th class=row_title>Location</th></tr>
<%
while(rs.next()){
RouteID=rs.getString(1);
RouteCode=rs.getString(2);
InBoundtime=rs.getString(4);
OutBoundtime=rs.getString(5);
BusNo=rs.getString(6);
Location=rs.getString(7);
DisRow++;
%><tr class= <%=(DisRow%2!=0)? "row_even" : "row_odd"%>>
<td><%=RouteID%></td>
<td><a onclick="sendInfo('<%=RouteCode%>') " ><%=RouteCode%></a></td>
<td><%=BusNo%></td>
<td><%=InBoundtime%></td>
<td><%=OutBoundtime%></td>
<td><%=Location%></td>
</tr><%
}
%></table><%
}
而下面的JS代码:
sendInfo(txt){
var txt = window.opener.document.addbus0.RouteCode;
txt.value = txtVal;
window.close();
}
每当与RouteCode
点击一个链接,然后在窗口的需求关闭并且所选的RouteCode
需要存储在会话中。我怎样才能做到这一点?
当你说会话时,你在谈论服务器端的'HttpSession'吗?浏览器中没有会话.. – 2011-05-20 17:14:58
另外,不推荐从JSP内部的scriptlet执行SQL。你至少可以使用JSTL进行循环。 – 2011-05-20 17:16:03