Session 从超链接获取会话值并将其传递到JSP中的另一个页面
我有一个页面,在前端使用标签显示后端的表。 现在我使用了while循环来显示表的行数。表中有3列,即“名称”、“日期”、“创建人”。现在,我已将“NAME”列放在标记中,使其成为链接,这样当用户单击特定名称时,我希望该名称值转到我在标记的href=“”属性中提到的另一个页面。我试图使用会话变量来使用它,但只传递null值。这是我的密码:Session 从超链接获取会话值并将其传递到JSP中的另一个页面,session,Session,我有一个页面,在前端使用标签显示后端的表。 现在我使用了while循环来显示表的行数。表中有3列,即“名称”、“日期”、“创建人”。现在,我已将“NAME”列放在标记中,使其成为链接,这样当用户单击特定名称时,我希望该名称值转到我在标记的href=“”属性中提到的另一个页面。我试图使用会话变量来使用它,但只传递null值。这是我的密码: <% try { Connection conn=null; Statement stmt=null;
<%
try
{
Connection conn=null;
Statement stmt=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:xyz","sa","pass");
stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("Select * from Topic where Status='Approved'");
%><table border="1" style="table-layout: fixed; width: 500px" >
<tr>
<th>Name</th>
<th>Date</th>
<th>Created By</th>
</tr>
<%
while(rs.next()){%>
<tr align="center">
<td height="20px"><a href="topiccomment.jsp"><%=rs.getString("TName")%></a></td>
<td height="20px"><%=rs.getString("Date")%></td>
<td height="20px"><%=rs.getString("Username")%></td>
</tr>
<%}%></table><br/><%
}
catch(Exception e){e.printStackTrace();}
%>
名称
日期
创建人
当我单击“我的主题1”时,它应该转到“topiccomment.jsp”,它应该在字符串变量中具有值“我的主题1”。如果我选择“tamal的主题”,它应该发送该值,如下所示