I want to keep jstl value(dynamic) in the session. How can I do? For example my code segment is : (userid is session attribute that is assigned previous page when student login the system)
<sql:setDataSource
var="myDS"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/loginuser"
user="root" password="root2"
/>
<sql:query var="listUsers" dataSource="${myDS}">
SELECT name FROM course_student where id = ?;
<sql:param value="${userid}" />
</sql:query>
<div align="center">
<table width= "23%" border="1" cellpadding="5">
<tr>
<th>Your courses</th>
</tr>
<c:forEach var="x" items="${listUsers.rows}">
<tr>
<td><a href=student_course.jsp> <c:out value="${x.name}" /></a></td>
</tr>
</c:forEach>
</table>
</div>
I didn't share all the code because it is long and can be complicated for you. I will explain code. It is a student-course system.Here, firstly I connect to database, then I bring his/her courses dynamically from database.
<td><a href=student_course.jsp> <c:out value="${x.name}" /></a></td>
here x.name bring all links(courses). For example; computer organization, database systems, object oriented programming I want to keep these variables in session WHEN LINK IS CLICKED! Which link was clicked by the user, its name should be stored in the session. Then I can handle in the new page according to this session variable.