<%
String page=request.getParameter("page");
String sid=request.getParameter("id");
int id=Integer.parseInt(sid);
int i=BabyNameDao.update(obj,id);
if(i>0){
response.sendRedirect("viewbabynames.jsp?page="+page);
}else{
response.sendRedirect("viewbabynames.jsp?page="+page);
}
%>
Asked
Active
Viewed 109 times
0
1 Answers
1
page
is an implicit object available in scriptlets, that refers to the current page. Choose another name that doesn't clash with implicit variables.
Or much better, stop using scriptlets. Scriptlets were fine to use in 2000. Since then, they've been continuously discouraged in favor of the JSP EL, the JSTL, and other taglibs.
And JSPs are a view technology. Updating the database and redirecting should be done in a controller, written in Java. Not in a JSP. Read How to avoid Java code in JSP files?