here's the JSP page snippet:
<table>
<tr>
<th class="checkbox"></th>
<th>ID no.</th>
<th>First Name</th>
<th>Last Name</th>
<th>Department</th>
<th>Experience</th>
</tr>
<%
List<Faculty> faculty = (List<Faculty>)request.getAttribute("facultylist");
for (Faculty record : faculty) {
%>
<tr id="id_1">
<td class="checkbox"><input type="checkbox" name="checkbox" value=<%=record.getId()%> /></td>
<td><%=record.getId()%></td>
<td><%=record.getName()%></td>
<td>lastname</td>
<td><%=record.getDept()%></td>
<td><%=record.getExp()%></td>
</tr>
<% } %>
</table>
</div>
</div>
</div>
<p class="last" align="right">
<input type="submit" value="submit" class="novisible" />
<a href="/InvigilatorRandomizer/logs" class="button form_submit"><span>Submit</span></a>
<br />
and this is a snippet of my controller class
@RequestMapping("/logs")
public ModelAndView helloWorld3(){
ModelAndView modelandview = new ModelAndView ("logs");
ApplicationContext context =
new ClassPathXmlApplicationContext("spring-dispatcher-servlet.xml");
FacultyJDBCTemplate facultyJDBCTemplate =
(FacultyJDBCTemplate)context.getBean("facultyJDBCTemplate");
//retreive list of faculty that are selected from submit.jsp and create the new list of faculty(selected)
List <Faculty> faculty = facultyJDBCTemplate.listFaculty();
RoomJDBCTemplate roomJDBCTemplate =
(RoomJDBCTemplate)context.getBean("roomJDBCTemplate");
List <Room> room = roomJDBCTemplate.listRoom();
modelandview.addObject("facultylist",faculty);
modelandview.addObject("roomlist",room);
((ConfigurableApplicationContext)context).close();
return modelandview;
I would like to retrieve the values of the checked boxes from the JSP page in the controller class.Any kind of input is appreciated.
Aucun commentaire:
Enregistrer un commentaire