Reputation: 715
I am doing my first web application and have a question about request/sessions doGet/doPost. At first, in a servlet called 'userConnection', user has to connect by entering username/password. Then I am creating a bean 'user' with other variables (username,password,etc..). I need this bean in the logic of the next servlet, MAKE_OFFER
In the doPost() method of userConnection I am doing
<..creating user bean object..>
request.setAttribute("user", user);
this.getServletContext().getRequestDispatcher( MAKE_OFFER ).forward(request, response);
MAKE_OFFER is the URL to another servlet. In this page, user has to fill a form to make an offer, and I am using the user bean information for some validation. But since getRequestDispatcher is calling the doPost() method, user didn't get the chance to fill the form yet so I'm getting errors about the form being empty. Should the user attribute be a session attribute instead of a request attribute? Is there a way I can bring the 'user' object to the MAKE_OFFER servlet, from the userConnection servlet, with or without calling doPost?
Thanks
Upvotes: 0
Views: 98
Reputation: 19445
I think you have a couple of issues here:
submit
should subsequently POST
to your MAKE_OFFER servlet.Upvotes: 1