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?
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.
精彩评论