Can anybody tell why JSP is the first preference in the industry. Why it is prefferd over applets/swings.The time taken in the development of Applet is mush lesser then the JSP when it comes to complicated pages containing multiple tables and panels.Speed is also not a problem since applet downloads once and then works faster then JSP(as it require server interaction lesser then JSP).What are the guidelines to select one out of them?
First of all, your statements are right if Applets work everywhere.
However, they do not work in all browsers. Also they need Java Plug-in,
but not everyone has Java Plug-in.
So, JSP is popular, because it produces pure HTML which works in every
browser. All the business logic is in the server.
In fact, Java plug-in is not an issue because all the common industrial browsers support it, and as a matter of fact, only one of them has the major market share and you know what ......
Basically, JSP and Applet belong to separate domains. JSP is a server-side technology which it is meant to interact with backend servers and databases. Applet is a client side technology and it runs on the client machine.
JSPs are more for thin clients and Applets/Swing apps for thick clients.
Usually Applets provide rich features which some customers require. With JSPs, you are bound to the features provided by HTML.
Also with applets, processing can occur at the client side. With JSPs, processing is all at the server-side, therefore you may see page refreshes.
The advantages of JSP which you have drawn can be seen as
1. All browsers supports it.
2. It is for thin client.
I suppose this is fine if the application is small. But if the application is big and complicated, where a user has to work the whole day long then probably the applet based application would be better.
Now a days all the browsers are having in built JRE. Does this means the applets will be in more demand then JSP. JSP gives the thin client but it also makes the development much difficult and also JSP clients make traffic to the server more heavier. Please suggest.
There are many reasons to choose JSP over applets.
- development time is less (in my experience)
- you're not limited by firewalls (many firewalls block applets from loading, and even if not block the applet from communicating with the outside world. This may not be an issue for an intranet application, but if it has to run over the internet it can be a severe problem)
- no need to redownload the applet to each client machine whenever the codebase changes. Applets are like traditional client/server applications, a distribution nightmare (though somewhat more automated).
- possibly less network traffic. If you don't want to have the version control problems you're having to make sure your applet isn't cached. That means your client has to download the entire thing each time he uses it, with large applets that can mean a great deal of network traffic indeed.
- security. You're transferring bytecode to clients over the internet/intranet. This might contain code to access secure resources that anyone with a decompiler can now freely see and use. You're also going to send possibly sensitive data over the network regularly, which can be intercepted easily. With JSPs you can just turn on HTTPS and your application is encrypted over the network, with applets you have to code all that (plus the entire communications protocol) yourself.
Applets in my experience are pretty much dead except for the traditional gimmicks of flashing buttons and stuff.
Also, remember "Custom Tags". There are libraries provided by Struts, JSTL etc wherein you have readymade functionality like "internationalization", "file upload" etc available at the touch of a "Cutom Tag".
Whenever I am developing a new app, I would always start off with a solution based on JSPs and work around problems.