java - How to perform UPDATE and DELETE operation simultaneously on JSP page ? -
this question has answer here:
i want perform multiple operation delete , update need send data controller, doing mistake??
following jsp page
<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <jsp:usebean id="timedetailbean" class="com.logic.bean.userbean" scope="application" /> <!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>manage results</title> </head> <body> <center> <h1>the employee_info results </h1> <table> <tr><th>name</th><th>last name</th><th>password</th></tr> <c:foreach items="${rows}" var="row"> <tr> <td><input type="text" name="name" value=${row.name}></td> <td><input type="text" name="lastname" value=${row.lastname}></td> <td><input type="text" name="password" value=${row.password}></td> <td><a href="update.do">update</a></td> <td><a href="delete.do">delete</a></td> </tr> </c:foreach> </table> </center> </body> </html>
and below controller want value of name ,lastname , password
@requestmapping("/delete") public modelandview delete(httpservletrequest request, httpservletresponse response) { system.out.println("delete controller executed"); userbean ub= new userbean(); dao d= new dao(); string name=request.getparameter("name"); string lastname=request.getparameter("lastname"); system.out.println("name catch"+name); system.out.println("lastname catch"+lastname); return new modelandview("deletesuccess"); }//delete ends
thanks in advance. .
in order send data jsp controller
- create form action (/delete) , method=post
- create controller @requestmapping("/delete") point form action
- use request.getparameter("name") in controller.
now on submit button in jsp spring servlet dispatcher mapping form in controller class , send data controller jsp.
let know if more inforamtion needed share sample example
regards, pavan