0
  <%

  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);
  }

  %>
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255
alif0325
  • 1
  • 1

1 Answers1

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?

Community
  • 1
  • 1
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255