how to insert multiple checkboxes into table with same row im using mvc web application this is jsp page: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <!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=ISO-8859-1"> <title>employee Registration</title> <style type="text/css"> body{ background-color: lightblue; } </style> </head> <body> <center> <h1>Add Employee Details</h1> <form action="Controller" method="post" name="frmaddemploye"> <input type="hidden" name="isEmployee" value="true"> <table> <tr> <td>USER ID:</td> <td><input type="text" name="userid" value="<c:out value="${user.userid }"/>"></td> </tr> <tr> <td>EMPLOYE NAME:</td> <td><input type="text" name="name" value="<c:out value="${user.name }"/>"></td> </tr> <tr> <td>EMAIL:</td> <td><input type="text" name="email" value="<c:out value="${user.email }"/>"></td> </tr> <tr> <td>DESIGNATION:</td> <td><input type="text" name="designation" value="<c:out value="${user.designation }"/>"></td> </tr> <tr> <td>HOBBIES:</td> <td> <input type="checkbox" name="hobbies" value="cricket">cricket <input type="checkbox" name="hobbies" value="hockey">hockey <input type="checkbox" name="hobbies" value="footvall">football <input type="checkbox" name="hobbies" value="chess">achess </td> </tr> <tr> <td colspan="2"> <input type="submit" value="submit"> <input type="reset" value="Reset"></td> </tr> <tr> <td> </tr> </table> </form> </center> </body> </html> and this is servlet: package employe; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Controller extends HttpServlet { private static final long serialVersionUID = 1L; private static String INSERTEMPLOYE_OR_EDIT = "/employeform.jsp"; private static String INSERTUSER_OR_EDIT ="/userform.jsp"; private static String EMPLOYEVIEW ="/employeview.jsp"; private static String USERVIEW ="/userview.jsp"; private static String LIST ="/index.jsp"; UserDao dao; public Controller() { super(); dao=new UserDao(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String forward = ""; String action = request.getParameter("action"); if(action.equalsIgnoreCase("employeview")) { request.setAttribute("users", dao.getAllEmployes()); forward = EMPLOYEVIEW; } if(action.equalsIgnoreCase("delete")) { String isEmploye = request.getParameter("isemploye"); if(isEmploye.equalsIgnoreCase("Yes")) { int userid=Integer.parseInt(request.getParameter("userid")); dao.delete(userid); request.setAttribute("users", dao.getAllEmployes()); forward =EMPLOYEVIEW; } else if(isEmploye.equalsIgnoreCase("No")) { int userid=Integer.parseInt(request.getParameter("userid")); dao.delete(userid); request.setAttribute("users", dao.getAllUsers()); forward = USERVIEW; | 0 |