I want to use jsp:forward for taking the user to the servlet
I know it is the current idiom to say "buttons on the jsp" but for clarity of thought you should say two buttons on the HTML page generated by the jsp. The action for one button will be a request to a jsp URL and the other a request to a servlet URL.
Are you using a web framework, such as JSF?
Are you using JSP scripting elements?
Do you just want to use HTML, maybe?
What I want to do here is:
On clicking on the ADD button the request should be forwarded to a servlet.
On clicking on the CANCEL button I want direct the user to a html page.
Earlier both ADD and CANCEL were taking the user to html pages.
If all you are doing is "forwarding" to another page, then did you know that you can achieve this with HTML button click events? Are you actually submitting a form for the Servlet to process, or are you just wanting to navigate to one page or another based on the button clicked?