• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

advantage of jsp

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what are the advantages of jsp's except that you dont have to write html is o/p stream as in servlets? and what is the proper way to code jsp's so that our code dont get exposed to the client?
 
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know much about jsp yet but i know enough on asp. And if it's anything as ASP it won't get exposed because it gets executed on server side and only end result will be redirected to users browsers.
 
ali farid
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
by client i mean if your application is hosted on the server of your company's client
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oopss sorry i must have misunderstood.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean you want to put only the class files on the client system and not the java source files, but you can't do this because jsp files gets translated into java source file the first time it is run?
Seems like it's not so much an issue, because you want to embed as little or no java code into the jsp page as possible - and put all the java business logic into beans, which can be called by the appropriate jsp tags. This makes the jsp page easier to maintain, and you can put only the class files of the javabean code on the client company's server.
------------------
United Health Group
Hartford, CT, USA
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all all JSPs' get translated to Servlets using JSP engine and then servlet classes will run.
Any jsp style code will get executed in the server side and will not appear on the client side.
Did you get some code which does not do the above? There should be none if the application server is according to the JSP specification.
Thank you,
Faisal
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are quite many advantages of JSP over servlets.
1. Jsps have the ability of dynamic html generation.
2. As far as the performance is concerned both have the same performance. Even though when a jsp page is accessed for the first time, it takes some time for the jsp engine to compile this page to a servlet and then execute this servlet. THIS DISADVANTAGE HAS BEEN REMOVED BY PRECOMPILATION OF JSP PAGES SO THAT EVEN IF THE JSP PAGE IS ACCESSED FIRST TIME THE USER ALWAYS GETS A PRE-COMPILED PAGE.
3. The best advantage of Jsp over servlets is JSP technology separates content logic from business logic. The role of context developer is separated from component (business logic) developer. A web designer need not know java language to code servlets logic.
HTH
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me make a general remark up front: in my view the main difference between JSPs and Servlets is that of emphasis. A JSP is a presentation-centered servlet. A servlet is a processing-centered JSP . The appropriate choice is dictated by the nature of the task at hand: presentation or processing.

Originally posted by Bharatesh H Kakamari:
There are quite many advantages of JSP over servlets.
1. Jsps have the ability of dynamic html generation.


So have servlets, even if out.println doesn't offer much in the way of sugar coating.

2. As far as the performance is concerned both have the same performance. Even though when a jsp page is accessed for the first time, it takes some time for the jsp engine to compile this page to a servlet and then execute this servlet. THIS DISADVANTAGE HAS BEEN REMOVED BY PRECOMPILATION OF JSP PAGES SO THAT EVEN IF THE JSP PAGE IS ACCESSED FIRST TIME THE USER ALWAYS GETS A PRE-COMPILED PAGE.


But the request is always routed through the JSP container servlet which usually checks the timestamp and then forwards to the actual jsp servlet, thereby imposing a (usually insignificant) bit of overhead.

3. The best advantage of Jsp over servlets is JSP technology separates content logic from business logic. The role of context developer is separated from component (business logic) developer. A web designer need not know java language to code servlets logic.


A good developer will be as careful separating presentation from business logic in Servlets as in jsps. In fact my experience is that jsps aren't any better in encouraging good separation of responsibilities than servlets are! There's too much Java code in too many jsps and in the worst cases it deteriorates into a more unsightly mess than you can ever achieve with servlets.
Having a good architecture is still too much down to disciplined development.
- Peter
 
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jsp can be used with beans that means declaring your functions in a bean and calling them in 'n' number of jsp pages.
which makes it super fast !
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The main advantage of jsp is that it seprates the java code from HTML.Means if in the case of servlets even if u want to do some changes in HTML than that will be the resposibilty of java progrmmer because he needs to compile that file but in the case of jsp ur jsp code is seprates from HTML althoug internally it creates a servlet of that which stuff the html data in to java code.But programming point of view it becomes very very easy.
and if u know ASP than JSP is very easy for u even u can go through the chapter ASP to JSP
 
Is that a spider in your hair? Here, threaten it with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic