• Post Reply Bookmark Topic Watch Topic
  • New Topic

regarding jsp and servlet  RSS feed

 
Priya Saxena
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell me...How to give alert message in servlet and redirected it to jsp page.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on what you call an alert message. You could put such a message in the request (HttpServletRequest#setAttribute) and forward to the JSP. (RequestDispatcher#forward).
You will have to explain a bit more about what you want to do exactly.
 
Prexa Shah
Greenhorn
Posts: 9
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:It depends on what you call an alert message. You could put such a message in the request (HttpServletRequest#setAttribute) and forward to the JSP. (RequestDispatcher#forward).
You will have to explain a bit more about what you want to do exactly.


hey can you give one example...i'm having a same problem..
In my servlet i'm updating my databse and at the end of successful operation i want to give alert message saying that database is updated successfully....

here is my code:



Thanks in advance...
-Prexa
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With send redirect you cant display the message where you want in the code. So as per me there might be two approaches. Display a message here and use include of requestdispatcher instead of send redirect or else pass some message to admin.jsp and display the message there.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!