user478636
user478636

Reputation: 3424

Posting on same form in JSP

I want to search for a product...so I have made a form...

but my products are being retreived in the doGet() method and when I search for a product, the doPost() method is called....

SO what should i Do?

Upvotes: 0

Views: 291

Answers (1)

BalusC
BalusC

Reputation: 1108852

It's actually unclear what your problem is. If you want the form submit to be idempotent/bookmarkable, then just remove method="post" from the HTML <form> element if you want the request to be bookmarkable. Don't forget to remove doPost() method from the servlet as well.

Or if you actually want to let the form submit to a different servlet, then just create another servlet, register/map it the same way but on a bit different URL pattern and finally change the action URL of the HTML <form> element.

Upvotes: 1

Related Questions