Valter Silva
Valter Silva

Reputation: 16656

How return a message from servlet without leave jsp?

i have a doubt, this is my scenario, when an user (in register.jsp) click in 'register' would like to go to my servlet and do all the stuff that have to be done. And i would like to return a message in the same register.jsp that tells if the register was sucessful or not, i don't want to redirect to another .jsp.

Is this possible ?

I developed a box that appears in the register checking if the data that the user provide are valid, is in javascript + css, i would like to use this box, if possible.

Best regards, Valter Henrique.

Upvotes: 0

Views: 523

Answers (2)

James.Xu
James.Xu

Reputation: 8295

use ajax, http://api.jquery.com/jQuery.ajax/

$.ajax({
  url: "check.jsp",
  context: document.body,
  success: function(){
     // do something when you got the message.
  }
});

Upvotes: 3

Jigar Joshi
Jigar Joshi

Reputation: 240996

You are looking for AJAX. You can do it with DWR easily.

Upvotes: 1

Related Questions