I have a jsp(newCustAc.jsp) that accepts some user's details and forewards them to a servlet which basically does some formatting to some part of the input and then calls the add() of a helper class to have it inserted into the Dbase.
Now, I have another jsp(renewCustAc.jsp) that does the same thing of accepting user's input. I want to reuse the same servlet as above that does the formatting and the inserting but instead of calling the add() of the helper class I want to call the update() of that class. How can I do this?. Is there some way to interrogate from which URL the request is coming from and then do some kind of If test to call the appropriate method. ?
You can easily add a parameter in the forwarded request to specify which action to execute, for example, use the following URL to forward to your servlet if you want to execute the add() method: /MyServlet?action=add
Then inside the servlet's doGet() method retrieve the value of the action parameter to decide which method to call:
I hope this will help you.
SCJP 90%<br />FileNet Certified Professional: Content Management Developer 92%<br />FileNet Certified Professional: Business Process Management Developer 92%