let me explain what i want to know.....
i am using a website where from the Administrator's page the Administrator can see the employee details(showEmployeeDetails.jsp) and also can update employee details(updEmployeeDetails.jsp).
the updation is done through updEmployeeDetails.java servlet, now if i want to call updEmployeeDetails.java from both showEmployeeDetails.jsp) and updEmployeeDetails.jsp, then is it possible??
is there any way to know which page is calling the servlet??
while seeing details, if the Administrator feels like updating or changing some data, she dont have to go back to the update.jsp page, and then from there calling updEmployeeDetails.jsp to finally update the detail calling updEmployeeDetails.java.
i want to minimize this hazzle.
...the updation is done through updEmployeeDetails.java servlet, now if i want to call updEmployeeDetails.java from both showEmployeeDetails.jsp) and updEmployeeDetails.jsp, then is it possible?? is there any way to know which page is calling the servlet??
Servlets are called from the URL patterns defined in web.xml. So if you want the same servlet to be called you should send the request to the correct servlet(using the URL pattern defined) with proper request parameters required to process the request.
Note: If you have done some code that we can see it would be easier to suggest what exactly (and how) should be done...
here is the code for updEmployeeDetails.jsp
which is calling the following file....
this file is again calling the following servlet...
now, what i am saying is that is it possible to call this servlet from the page where i am checking the employee details?
my web.xml file is this.....
Sooooo many of codes...............................
In to your code:
According to this code when the first JSP calls the second it needs a form submit in order to display the data which does not happen automatically. So you'll have to change the design accordingly. Use JSPs only as a view component. This way you can avoid most of the confusion in the code. And call your servlet which handles the retrieval of customer data when user submit a query parameter. Then you may display them in a different JSP by forwarding the request from the servlet.
You may read about MVC pattern to get a better idea how this happens...
Also read about the Request Dispatcher on how to dispatch requests....
but ok, now i will store the values fetched, into session/context and then display it into the view.
thanks for reminding me.
i will keep it in mind everytime i code.