April 10th, 2001, 10:59 PM
Hi, my name is Joubert. Iīm a brazilian student. I bought the book java servlet programming and I canīt find how can I call two or more servlets simultaneously when a single form is submitted from the client to the JavaWebServer??? I can do that or itīs impossible??? And if the same two servlets reside on two diferents webServers (Two different machines)???
These answers are very important for me. Thanks for your help.
April 19th, 2001, 08:17 PM
I am confused as to why you would want to post to 2 servlets. HTML will not allow this, you can only have one value for the 'action' attribute. However, I suppose you could have a gateway servlet that could call the 2 servlets and return the results. If you could elaborate on what you are trying to accomplish, I guess we could evaluate the problem better. But other than that I would suggest the gateway servlet, but If the reside on different servers you will have to use URLConnection class to call the remote servlet.
April 21st, 2001, 01:00 PM
Hi, Now I'm trying to make an application that will listen the port 80 and buffered the Url sent by client. After that, it's just duplicate the string buffered, changes the action atribute and send to one or more machines with different web Servers and different servlets, for example.
I hope this will work!!
Thanks for your help, Joubert
April 21st, 2001, 11:35 PM
Joubert, using multiple servlets is not that difficult. Servlet chaining is a powerful aspect of Java, and you should be able to use the forward or include properties to pass parameters to multiple servlets, which can collaborate.
If you are doing this from an HTML form, it would be easier to package your web page under the auspices of .jsp, then utilize the <jsp:forward> and <jsp:include> tags to process the data from the form into the multiple servlets or beans you are utilizing. (The .jsp engine itself is a big servlet you can utilize to speak with another servlet.)
Hope this helps.
April 23rd, 2001, 02:45 AM
how to call servlets
using servlet chaing you can call one or more servlets simaltaniously.actually to call a servlet from html you should mention the servlet path at action
when ever you submited than the header calls the sevlet which reside in your websever that in servlets directory in your webserver root.
this is normally calling an servlet
other wise you want to call a servlet from another is
using sendRedirect(" ") method in SevletResonese