jussara
asked on
HOWTO invoke a method on another Servlet from my Servlet?
Hello!
How can my Servlet invoke a public method on another Servlet?
Thanks.
How can my Servlet invoke a public method on another Servlet?
Thanks.
Hmmm, interesting. I was reading that the method 'getServletNames()' is deprecated. It wont be along much longer. So, I would guess in such a situation the use of reflection would work. But it is an interesting problem.
Tom
Tom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
interservlet communication was deprecated and will be (has been?) removed in later versions because of security reasons.
The best way to achieve it is by having the servlets call one another over HTTP, and having the service method throw back the response based on the parameters passed (passing in the function to be called as a parameter, and parameters to it as other parameters for example).
The best way to achieve it is by having the servlets call one another over HTTP, and having the service method throw back the response based on the parameters passed (passing in the function to be called as a parameter, and parameters to it as other parameters for example).
jussara:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
Recommendation: points to jim_cakalic
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- Points for jim_cakalic
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Venabili
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
- Points for jim_cakalic
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Venabili
EE Cleanup Volunteer
Example:-
ServletContext sc = getServletConfig().getServ
Enumeration servletNames = sc.getServletNames(); //will return the available servlet names
MyServlet myServlet = (MyServlet)sc.getServlet("
String name = myServlet.getNames(); //execute the public method.
...dviji