File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes A web interface to a small java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "A web interface to a small java application" Watch "A web interface to a small java application" New topic

A web interface to a small java application

Simon Harvey

Joined: Nov 23, 2002
Posts: 13
Hi everyone,
I have a problem that I'm hoping someone can advise me with. Any pointers would be a huge help.
I have coded a fairly simple server application that monitors an oracle database and alerts clients if there is a problem. The clients themselves are currently java applications as well.
What I would like to do is create some sort of web interface. From this interface I would like to be able to log in, check for any queued alerts and also perhaps have the page sit as a sort of homepage for the database administrator.
So my fairly broad question is - what possible avenues should I be looking into.
Perhaps more specifically I'm currenty thinking about what sort of technology would allow a webpage communicate with a java program sitting perhaps on another machine. Id need the server program to be able to update the users webpage should an interesting event occur.
The only thing that springs to mind would be to use a servlet of some sort. Am I right in thinking that servlets can be used for more than just outputting dynamic webpages? Could a servlet do the sort of thing that I am asking of it, ie accept communications from another application? Or am I really in the wrong ball park?
Any advice on any prospective technologies or techniques would be gratefully received. This is actually for my final year project at university and I'd really appreciate any leads you gurus could offer
Kind Regards

Simon Harvey
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
There's nothing special about servlets. The servlet API is just a means of specifying the way web servers interact with your Java code. You can do anything in a servlet that you can in any other Java program.
However, you may find that the main limitation to what you want to do is the request/response nature of web browsers. It's very hard for a web page to be updated to contain new information, without the browser asking the server for the page again.
If you want information to appear on the page as soon as it happens, you may need to put an applet on the page, and have the applet accept some sort of messages from the server.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Simon Harvey

Joined: Nov 23, 2002
Posts: 13
Thanks for that. I think this might be getting off topic (but I dont know if I still need to involve servlets somehow) but I know there are some limitations on applets - I would be communicating with it from the server on which the applet originated from, so that should be ok, but if you want to communicate with applets do you just use sockets like you would use then with a standalone application. Because its in a webpage, is there anything special I have to do? Does it just listen on a port? I thought there might be some restriction on that?
Is the servlet element out the window? Sorry to everyone if this has gone OT
Thanks everyone
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Please beware that this topic is duplicated in JiG (Intermediate). Simon, please don't do that.
- Peter
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
For applet/servlet communication, the simplest thing is to use regular HTTP port 80 requests from the applet and responses from the servlet. That way you get fewer problems with firewalls (which is why SOAP emphasizes it.)
If you tried some sort of permanent socket connection, you might get locked out by firewalls.
Note that the applet has to originate the request, but your servlet response could be very compact if the status had not changed.
I agree. Here's the link:
subject: A web interface to a small java application
It's not a secret anymore!