Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Exampples of delete servlets and jsp

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys I have done out a delete servlet, however I do not know how to carry on in my jsp like when I choose to delete the 1101 record it will delete.

This is my servlet:

Thanks:) You guys have certainly help me a lot:)
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sendRedirect is not what you want here.

It sends the 302 status code back to the client which then triggers the redirect on the client side.

If you want to forward processing to a JSP you need to obtain a RequestDispatcher (request.getRequestDispatcher("/file.jsp")) and then forward.
 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry can you explain it more. Cause I dont understand it. Sorry:(
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
response.sendRedirect sends a response back to the client and tell him to redirect to another page.

The point here is that the request has finished. All data that has been stored in scopes lower than SESSION is lost.

The usual procedure is to forward responsibility to another servlet or in most cases JSP.

It's like saying 'Here JSP, I have done my work and set up all the resources for you to generate a wonderful page for the client, you can carry on from now on).
The client doesn't know about this, it happens on the server side.
 
Loh Peggie
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see I see.Thanks:)
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OTOH a forward won't prevent a refresh of the page trying to do the same delete; that's why the post-redirect-get pattern exists.
 
I am displeased. You are no longer allowed to read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic