• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What are advantages of applets?

 
Adithya Rayaprolu
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to know the advantages of applets over using HTML with Javascript. We have complex forms in our pages, for complex calculations. We already implemented the prototypes for the screens using HTML and Javascript, now we have a question. We can do almost anything with just Javascript. In this case, why should one go for applets? What are their advantages over DHTML? Which takes less download time, applet or HTML with Javascript?
Thanks a lot in advance.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Adithya,
i had the same question when i started out really with applet application.
here is what i found after thinking a bit,
1. if you have the following application you can't probably use JavaScript/HTML in anyway,
You have hierarchical data to be input. meaning say you have a form where you want to have a functionality of "next", "previous", "add", "edit" buttons.
you have a list of profiles for various companies to be filled out. so thats one level. now, in each profile you have another sub list sort of data that is say "contacts" - which provides list of contacts within a company. so this "contacts" is level2 of the hierarchy, right?
how would you implement "add","edit", "next", "previous", "delete" etc functionality for the single form using HTML/JavaScript only?
you would end up popping up many windows and still it won't be as "intiutive" as you would implement this with the Applet.
the problem here is to store the hierarchichal data in intermediate form before you store it to the server side, if you know what i mean...because in HTML/JavaScript when you go back you loose data within JavaScript if you decide to store intermediate data in a Object within JavaScript (even though the HTML data may sustain iteself)...
i hope i am able to explain things,

2. if you use Applet then you can't do "view source" and "save as image" or anything that is possible for HTML code and sometimes its required to hide source and not allow users to download image or something..
Applet hides the whole code. you never know WHAT exactly is going in WHICH FORMAT and WHERE...
3. you don't end up using DHTML for some good effects and DHTML is sometimes difficult due to browser issues (though one can argue that in certain situations we can use Flash objects and embed that in HTML etc..)
basically, you can use some cool stuff from Applet and Java API (Swing look and feel)...
somethings you can achieve with JavaScript also but its a messy code, right? we have to write so much...
4. if you have a "Signed Applet" you can do wonders i would say...won't you agree? because we would be able to access the client system and all..
Others please add to this list...

Now, "there is no FREE lunch" there are problems of various categories using the applet...
1. what if you want to do session management. there is no direct functionality in Applet to do it...this applies to situations where your applet is going to used by many persons and you want to have state stored (i remember questions of this sort in JavaRanch sometime ago).
2. biggest issue is Java Runtime environment + Browser issues + API compatibility issues (specially with JDK1.4)
(you would find problems arising due to OBJECT/EMBED tags in this forum in combination with NN4.7/7 and IE issues)
3. using "java.policy" file would have to be handled in such a manner that the end user doesn't end up spending time understand "whys" and "whats" and "where" and you know...
4. Applet restrictions applies if its not signed and we have to live with things that are available if we can't make applet signed somehow..
(due to monetory issues and other issues)
5. support issues (though it can be overcome) on Windows XP due to corporate fights...
Other please feel free to add to this list as well..

regards
maulin
 
Adithya Rayaprolu
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maulin,
Thanks a lot for the reply. So, one biggest disadvantage of applet is Session management. We are developing a fixed income project, we have to do bond calculations. In one of our table, we have many columns. After entering some information in one cell and tabbing out, we need to fill in the other cells for that row dynamically, the information to fill other cells has to be fetched from server, this requires session management. Can't we do this with applets? How about applet-servlet communication? I don't really know how applets and servlets interact. If we want to do this using javascript, how can we receive the other cells' information to populate the table dynamically?
Thanks a lot in advance.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i meant that session is difficult thing using applets...but what you have is not probably the session management...you just need some data based on some field populated in another field right?
i mean, i usually interpret session as the scenario where we want to store particular set of values for some specific timeperiod during which user is "logged on"...
well, in anycase...
applet-servlet communication is not difficult. you just open URLConnection to the servlet you want to communicate with and then getInputStream() and getOutputStream() to read/write data to the servlet...if you have a Oreilly's book - "Java Servlets" then please have look in there. they have explained things in details.
i don't have applet-servlet communication code right now but it would be best if you read some example and then copy it or rewrite on your own to have applet/servlet communication...
if somebody else has it he/she can help you probably.
if you want to have javascript functionality (forgetting the applet stuff) then you can put onBlur() event handler of JavaScript on fields and then if you already have the appropriate values then populate other fields using javascript's function you know...
still, i'm curious to gather more and more input on advantages/benefits of applet vs. javascript/html and vice-versa issue if others are "ON"
regards
maulin
 
Tim Holloway
Saloon Keeper
Posts: 18359
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Session management is no real problem. I was delighted to discover that things like session cookie-handling are automagically taken care of using the URLConnection to do http tunneling - no session code need be written, it simply inherits from the container (browser).
One of the BIGGER problems with applets was that the browser standard was an antique pre-Swing version. Or worse, for people starting with Win/XP from scratch, none at all. Sure you CAN tell people they have to download a 5MB plug-in, but WILL they?
However, thanks to Monday's judicial ruling, Windows may end up supporting JDK1.4 whether they like it or not, and that in turn puts pressure on other platforms to move into the 21st Century (literally!).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic