HELP!! HTML form -> Servlet -> Java Application

Hey everyone,

I need some help...

I want create something that works as follows:

- A client fills in an HTML-form

- when the form is submitted, it send its data to a servlet

- the servlet processes the received data and sends it to a java application running on an other computer which shows the processed data.

Does anyone have an idea how I can get this done? Is it possible using Tomcat-server or do I need an other one?

All hints are welcome!!

Tnx!

[508 byte] By [NikkiEijpena] at [2007-11-26 17:36:02]
# 1

Hi......

What about the second application ? is it a web application? or stand alone application?

if it is a webapplication you can consider using URLConnection.

if it is stand alone application u can use Some thing like RMI.

check it to know how to send data from one application to another using URLConnection

http://www.theserverside.com/discussions/thread.tss?thread_id=40922#211833

take a look at HTTP Client component from apache. it can be used to post data from one application to another programatically

http://jakarta.apache.org/commons/httpclient/

Sudhir Nimavat

Sudhir_nimavata at 2007-7-9 0:04:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

The code fragment below shows how to send a POST method to a servlet URL.

Write down this code in ur first servlet. to post data to some servlet in other application

// connect to the servlet

String location = "http://www.foo.com/servlet/servlet2";

URL testServlet = new URL( servletLocation );

URLConnection servletConnection = testServlet.openConnection();

// inform the connection that we will send output and accept input

servletConnection.setDoInput(true);

servletConnection.setDoOutput(true);

// Don't use a cached version of URL connection.

servletConnection.setUseCaches (false);

servletConnection.setDefaultUseCaches (false);

// Specify the content type that we will send binary data

servletConnection.setRequestProperty

("Content-Type", "<insert favorite mime type>");

// get input and output streams on servlet

. . .

// send your data to the servlet

. . .

Sudhir Nimavat

Sudhir_nimavata at 2007-7-9 0:04:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

It seems you are trying to give some parameters to Java application which is at different machine.so you can use sendRedirect() in servlet1 and send the request to another servlet2 in another machine.and this servlet2 will fetch the parameter given by client using ServletContext.getContext.getAttribute().but at last line you have wriiten some java class is trying to catch the client data.then my answer is that Sevlet2 in another machine is also a java class(Servlet is Java Class)

CookBookJa at 2007-7-9 0:04:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...