I have a question that If I have set a variable like this
request.setAttribute("attr1","This is Value -1");
and I can also do this like
request.getSession().setAttribute("attr1","This is Value-1");
I can access both varibles in JSP like
so what is difference and what is advantage of one over other?
Good question. The difference is what happens if you try to do the same thing on a later page. The session attribute will still be available. The request attribute will be long gone as it only exists for one request/response cycle.
Why don't we put everything in the session you ask? It takes up memory and produces "clutter".
I asked this question in this seneraio
I am using Spring Framework to design a Web Application there is a task controller in my web application which is receiving request from views after it has done its work then it need again to redirect to view.Problem is if I use something like
then "task Controller URL" is still on URL
although I can set objects in that
so what I am using
and problem with this approach is If I am forwarding 200 requests then all those request are still on the session
So I am thing another appraoch for this
if it is possible