Redirect a page and pass some message

by Vinoth 2008-12-19 11:26:44

Hi,
If you want to redirect a page with some message can be add the following code to your servlet coding.

RequestDispatcher rd = request.getRequestDispatcher("Resource File's url");
Object obj=new Object();//add content to obj

request.setAttribute("msg",obj);
rd.forward(req, resp);

You can get the object in your resource file by using

Object obj=(Object)request.getAttribute("msg");


Regards,
Vinoth.

Tagged in:

4408
like
0
dislike
0
mail
flag

You must LOGIN to add comments