views:

79

answers:

1

In the lab I work in, we use Mozilla 1.7 for Sun Java™ Desktop System and Firefox 2.0.0.4. My goal is to modify an existing Java application (run via executable jar) to communicate with our web-based login system.

I am open to the idea of using both Java Applets and JavaScript to accomplish this task, but I have not found a way to integrate these two technologies in any browser but Netscape Navigator and Internet explorer.

Is there a way to do this using either of the two aforementioned browsers?

A more concrete example:
1. Launch application
2. Click a "login" button
3. Be prompted for a password
4. In the background, have the application connect to the web-based login server, enter the username (known by the app) and the password, navigate to the time clock section and "click" the Punch In button
5. Pull the timestamp of the login (typically displayed on the browser) and display it in the app

A: 

Look at HTTPURLConnection and perform POST of the same values login form contains to the same URL.

Vladimir Dyuzhev
It looks like the GET and POST is the solution I've been looking for. I am able to find the credential fields and enter text, but how does one simulate a button click? The line in the source code is: <input type="button" name="login" value="Log In" onClick="doLogin();"> It seems I would either invoke the onclick property of the button or make a direct call to doLogin(), but I am unsure how to do either. Thanks for the help so far.
You need to look at what the JavaScript function doLogin is doing. It is most likely submitting the form.
Clint