Hi, I have a requirement where i want my primary field[Prod Id] in the form (in JSP) to be populated at page loading time.. i.e the value of the field has to be fetched from the database (Max Value of Prod Id +1 ).. This form is used to create a new product , The Prod Id is pre-populated and is a read-only field.. the other values are to be entered by the user.
Your servlet controller should cooperate with a "model" class to obtain the value from the database. Is this the part you are havng trouble with?
Once obtained, the value can be placed on the request as an attribute (aka scoped variable). The controller forwards to the JSP page which uses the scoped variable to fill in the value attribute of the form element.
It's not clear which part of this process is giving you problems.
Hi The scenario was for creating a new product, when the user clicks on Create New Product, it was forwarded to the JSP page where the fields were supposed to be entered, and i had no idea how to populate the Product Id,
Now I feel it would be better if instead of forwarding to the JSP Page... on clicking on Create a new Product, call the servlet which will set the product id value in the request and forward to the JSP page where i can fetch the value and set it in the Prod Id field