• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP/ Servlet

 
Megha Jain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone help me on this............ I am working on Core java and JSP as well........ i don't know abt servelets...... i am having one doubt, All jsp files get converted into servlets after execution......... JSp is easy as campared to servlets........ so why to go 4 servlets.....
Servlets are faster.......... but still jsp has many advantages over servlet......... So is it necessary for me to do servlets as well.
Thanks
Bye
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSp is easy as campared to servlets.

Where did you get that idea? JSP handles some presentation details conveniently, but the concepts you need to understand are the same ones you need for servlets.
Bill
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Servlets are server extensions that are used add a functionality to the webserver. These implementation could be a specialized services such as authentication, authorization, database validation, or transaction management.

Servlets act as a controller that control business logic
Servlets are developed by java programmers with strong object oriented programming skill
Any webpage designer can write jsp with a little knowledge of java and jsp tags.
i hope it will clear your doubt.

if anything more than this please post in this forum
bye for now
sat
 
Megha Jain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for that one................ but still some confusions........ The project in which i am working......... in that we had hardly used servlets.. and we have provided authentications, authorizations..etc using jsp .... if i can do all these things using jsp when why servlet.

because if i have tyo make any changes in files..... i can make that changes very easily in jsp and save........ whereas in case of servlets i have to recomplile them and than again redeploy....

So plz tell.....
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Megha Jain:
JSp is easy as campared to servlets........ so why to go 4 servlets.....

That is where you are wrong.
JSPs may seem easier than servlets if you aren't comfortable with setting up your environment and running a compiler (which isn't all that hard).

Once past that hurdle, you will find servlets to be much more clear and straight forward. Their methods are well named and self descriptive.
They also haven't changed or grown much since their inception because there wasn't a need.

JSP (an abstraction meant to make it easier for non-programmer web designers to dress up the look and feel of a web app) hides and convolutes the structure of a servlet. They've grown and changed over the years. Features and ways to do things have been added but never removed. The result is 2 or 3 ways to express almost everything. Without a lot of discipline it would be extremely difficult a large project under one coding convention.

Each is an an excellent tool (as is the JavaBean) for it's intended purpose.
Together, the three provide the best platform (in my humble opion) for creating scaleable and managable web application.

Learn how to use all three, and how to combine them in a Model View Controller (MVC) architecture and you will have answered your own question.
 
Vikas Bhatia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Megha Jain:
Hi,

Thanks for that one................ but still some confusions........ The project in which i am working......... in that we had hardly used servlets.. and we have provided authentications, authorizations..etc using jsp .... if i can do all these things using jsp when why servlet.

because if i have tyo make any changes in files..... i can make that changes very easily in jsp and save........ whereas in case of servlets i have to recomplile them and than again redeploy....

So plz tell.....


1. When you are saving the JSP, you are in essence recompiling the back end servlet.
2. JSP are primarily meant to act as a presentation layer, but can be used for doing "java stuff".
3. I am not sure about your application design, maybe you do not need servlets, but consider a scenario that you are navigating from one page to the other, but in between you need to carry out some business logic, or do something like: send a message, execute a database lookup, write to a log etc., you will find that your JSPs will be cluttered with java code, something that really does not belong in there.

I would say that uptil now, you have not encountered a situation which would demand the decoupling of your business logic from presentation, hence the core of the doubt.

cheers
 
Megha Jain
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot .......... to both of u.............. I understood.......... No more qustions............. Just have to start learning servlets now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!