Applet-Servlet communication

I am trying to design a system wherein applets will be used to design the GUI and perform basic validations. The business logic resides in Servlets.
The front-end needs menus. Hence, I am not using HTML-servlets. Only the first servlet throws HTML with an embedded APPLET tag. With this APPLET tag I am fetching all the classes at the browser. This APPLET creates a main window(frame on top of the browser) from which other child frames will be created  as and when we click on the menu items.

In these child windows I will be accepting user input, packaging them in a serializable object and sending it over to some other servlet which processes the info contained in the object. The servlet might update a DB table or send some other object back to the originator (child) window.
(Mind you, this servlet does NOT send any HTML tag. HTMLs are sent only by the first servlet).

My questions are:
1) Is this a good architecture. Can someone suggest something better. In fact, Sun's Java Web servers admin console uses a similar architecture.

2) If the child window need to send a serializable object to the servlet, can it do so directly. Or, will it have to ge through the main frame or the applet...
How does it do it? Does it just open a connection to the servlet and write to it as is normally done in simple applet-servlet communication?

3) Does any one know whether the source codes are available for the corresponding .class files available in jstadmin.zip  with Sun's JavaWebServer2.0

Regards.
SHashAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ravindra76Connect With a Mentor Commented:

Hi Shash,

1.Your architecuture ( Applet - Servlet ) communication is fine. No doubts about it due to your menu requirements.

Anyhow applet will do client side processing which a static HTML page won't do without using Scripts.

2.I Think applet_servlet communication through connection won't depend on Windows. No need to go to main Window.

3.Sorry. I don't know.

If You have already known applet to servlet communication, it is fine.

Otherwise visit this URLS

http://www.j-nine.com/pubs/applet2servlet/Applet2Servlet.html 

http://www.servlets.com/jsp/examples/index.html   

Best of luck
0
 
mbormannCommented:
(1)This is a good way according to me ,I think that if you want in CORBA/RMI you will have firewall issues which is removed in case of servlets if your design wherever it is going to vbe deployed is supporting HTTP ,of course one can argue that RMI/CORBA is also possible but I think that this is easier.

But this is easier said than done.
My first suggestion is buy Jason Hunter's book and read it cover to cover,see the thumbnails at http://www.servlets.com/

Jason has discussed among others
(1) HttpPostMessage class (name maybe different) which can be used to 'post' data to servlet from Applet.
(2)FileUpload to upload files from client to servlet
(3)Exception Logger servlet whereby all client exceptions are logged to a dedicated servlet , i would suggest add a log level ,i.e in Applet side

try
{
//code
}
catch(Exception e)
{
//Note this is sent thru the HttpPostMessage
ExceptionLogger.log("String Classname where occurred with full package",
int logLevel(0=all log statements logged 5=reserved for critical errors),
"String Log Message"
);
}


(2) I would suggest that the applet sends to servlet in a single structured manner thru the HttpPostMessage class ,this eliminates code duplication ,and is horrible when u try to maintain that code later on ,u have to hunt around a zillion times.

(3)I dont think it's available if u r really desperate use a decompiler
0
 
SHashAuthor Commented:
It helped.
0
 
mbormannCommented:
?
0
All Courses

From novice to tech pro — start learning today.