Hi all, I have a servlet in one application "A" and i want to call another servlet in an application "B" from the first servlet. How do i do this. if possible pl tell me the same in case of EJBs too as to how to call an EJB which is existing in another application
Hi, Regarding calling the servlet... If your servlet 'A' has a html code embeded in out.println("....")...then you can specify the servlet "b" in the action part of the form...i.e.... <form method = get or post action ="Your servlet path here"> </form> otherwise.... you can use sendRedirect(servlet path here)...to call servlet"b" In case of EJB you can call another EJB by specifying the correct JNDI name in lookup for the second EJB.
posted 17 years ago
Hi Shripad, I think U have overlooked the question.Am asking how to call a servlet which is in web application "B" from a servlet which is in application "A" and How do i call an EJB which is in application "B" from an EJB which is application "A" Thanx
Hi You could use ServletContext to link call the servlet. With an EJB, the first EJB must communicate to the second, as an EJB client would. Get the reference of the Home Object and then access it. Suneel [This message has been edited by Suneel Setlur (edited January 31, 2001).]
Hi suneel, I tried the same with this code. getServletConfig().getServletContext().getRequestDispatcher("/servlet/ViewMiniPoll").forward(req,res); But I could succeed it calling the servlet ViewMiniPoll which is different in Web application.I am using JRun 3.0 Thanks in advance Karthi
Karthi Bala<br />SCJP 1.2, SCWCD 1.3, SCWCD 1.4, SCDJWS (Awaiting Result)<br /> <br />Where there is a will,there is a WAY.