How to pass a object of a class from one jsp page to another jsp page?
I had set the object of one class to one variable. In Screen3.jsp i have given like <A HREF = 'http://localhost:8080/JSP/Screen4.jsp? valueobject=<%=v1%>'> <%=s%> </A> where v1 is the object of an class.
In Screen4.jsp, i am retrieving the variable like v2=(ValueObject)request.getParameter("valueobject");
But i am unable to do it. Help me plz. Thanks in Advance.
You should probably check for nulls when retrieving the object, and it must be explicitly cast a class if you want to use any class methods on it other than those defined in Object.
Alternatively, you can save objects in cookies or pass them via URL parameters as in your example, but technically those can't be passed as objects. They must be converted to encoded/decoded in some string format. Session objects are used, therefore, to save complex objects not easily encoded as string parameters or to monitor state.