Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Servlets -- Sending details. URGENT ! !

Options
  • 31-03-2004 7:20pm
    #1
    Closed Accounts Posts: 1,233 ✭✭✭


    Hi,

    I have a programming problem which I need urgent help with....

    1.) I firstly have a HTML file which a user will fill out 3 fields on and submit.

    2.) A servlet will get these parameters, vaidate some information and update a database.

    Problem Part Needs to send on these details to another servlet which will be located on a seperate server.
    Is there a way of doing a submit like function without an actual submit, as this will all be done away from the user.

    Was initially going to use:
    ctx = getServletContext();
    rd = ctx.getRequestDispatcher("https://localhost:8443/servlet/FileName");

    But found out you can only do this with files in the same immediate location!

    3.) Next servlet will accept in the same details as 2, and do some more functions and database updating. Before again sendin on some details to another servlet! (so same problem as in 2).

    4.) Accepts in details from 3 and updaes database!

    Basically I need to emulate a post request!

    Any ideas how this can be done??

    Any help greatly appreciated.
    DBM.


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Originally posted by Dont Ban Me

    But found out you can only do this with files in the same immediate location!

    Can you not give the two servers the same domain and use SSO?


  • Closed Accounts Posts: 1,233 ✭✭✭Dont Ban Me


    Servers have to remain seperate as they could be opposite ends of the country or world!

    Servlet 3 have to completely independent!


  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    You could proxy the connection to the other server on the first server.

    The result of 1st servlet could write out HTML with a form and hidden values, and use javascript to submit the form when loaded.

    .cg


  • Registered Users Posts: 3,132 ✭✭✭oneweb


    What about passing the values in the url? (foregoing security)

    http://otherserver/path/otherservlet?field1=bla&field2=blu

    It is what it's.



  • Registered Users Posts: 139 ✭✭soiaf


    If you want the first servlet to call a 2nd servlet, you can do that pretty easily with the java.net.URL object.
    A quick google search gets sample code on doing a POST call e.g.

    http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=ffaqs/01221

    So the first servlet would call the second servlet, the second servlet would call the third servlet etc.

    Of course the real question is how 'guaranteed' do you want this process to be? If for example the 3rd servlet is not available (say the server is temporarily down), do you want to roll-back the changes you made as a result of servlet 1 and 2? Or do you want the call to servlet3 to continue till its successfully done?
    A lot more code involved here - probably using something like JMS


  • Advertisement
  • Closed Accounts Posts: 1,233 ✭✭✭Dont Ban Me


    I'll try the URL thingy now! Thanks for the replies....

    I think Im allergic to java! :(


Advertisement