Re: Should I use applet for client side, servlet for server side or both?
Friday, April 4, 2003 08:24 AM
This question depends primarily on your requirements your amount of time you want to invest and last but not least on your personal preferences. I can give you an overview of my experiences that you might want or want not to consider:Everything you can do with a servlet can be done with cgi or php as well and for simple applications the use of these is usually easier. Using servlets tends to make easy tasks more complex. For big projects where maintanability and scalability is important, servlets (and JSPs) used together with features of java enterprise edition
can be usefull.
I use applets in my web applications to decrease the server load which means that my applets do things that would have otherwise to be done on the server (by servlets or cgi scripts). For example if i want to present a list of customers i wrote an applet that loads all customers in the first request. Filtering, sorting and so on, is done by my applet not on the server. This does not only reduce the server load but also increase speed.
If you use servlets and applets together, many classes can be used for both (a reasonable design preconditioned). This can reduce the amount of work. Nevertheless I generally find it easier to genereate HTML or XML code on the server than programming an applet.
You can be pretty sure that if you leave the interpretation of HTML code to browsers that you will see an acceptable result on almost any browser. you cannot presume that your carefully programmed applet will run in every browser. Some VM implementations are quite buggy. Testing applets requires (often many times) more time than programming them.
Java, J2EE, Servlets and JSPs are buzzwords that sound cool and professional to decision makers. In my opinion, there is still a java hype without rational foundation. But why not use these techniques if you can sell your application just because of these buzzwords?