Thread: Call Servlets

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    0
    Rep Power
    0
    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.
    Joubert.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 1999
    Location
    Columbia, SC
    Posts
    5
    Rep Power
    0
    Joubert,
    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.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    0
    Rep Power
    0
    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
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Cebu City, PH
    Posts
    1
    Rep Power
    0

    Multiple Servlets


    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.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    chennai,india
    Posts
    0
    Rep Power
    0

    how to call servlets


    hai joubert
    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
    for examle
    <form action="http://localhost:8080/sevlet/something>
    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
    okay
    rao.java

IMN logo majestic logo spyfu logo threadwatch logo seochat tools logo