java - How to get attribute from another page -


Let's say I have page1.jsp and I do:

  request .setAttribute ("Message", "This is My Error Message"); Response.sendRedirect ("page2.jsp");  

In my page 2.jsp, I try to get the message using this code:

   

But the result is zero. I could do this response.sendRedirect ("page2.jsp? Message = error message"); You can get the message with and request.getParameter , but I do not like this view. Any other ideas?

You can forward the request instead of redirecting it. Forwarding is transparent to the user, while a redirect actually sends 302 response codes and creates a new request.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -