| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
#1 (permalink) |
|
Member
Join Date: Feb 2006
Location: India
Posts: 48
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4
|
Friends This is Java Interview Question asked by TCS,Pune : Q.) Ican do every thing in jsp itself,then what is the need of servlet? Please reply. Aparna. |
|
|
|
|
|
#2 (permalink) |
|
Moderator
Join Date: Feb 2006
Posts: 1,413
Thanks: 0 Thanked 9 Times in 8 Posts Thanks: 0
Thanked 9 Times in 8 Posts
Rep Power: 18
|
hello
JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed. JSP pages are focused a round HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed. Servlets are modules that extend request/response-oriented servers, such as java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company’s order database. Each Servlet has the same life cycle: a) A server loads and initializes the servlet by init () method. b) The servlet handles zero or more client’s requests through service() method. c) The server removes the servlet through destroy() method.
__________________
http://livetolead.blogspot.com/ all the best Arise Awake N Stop Not Until Ur Goal Is Reached! |
|
|
|
|
|
#3 (permalink) |
|
Member
Join Date: Feb 2006
Location: India
Posts: 45
Thanks: 0 Thanked 2 Times in 2 Posts Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 3
|
Ican do every thing in jsp itself,then what is the need of servlet? hi aparna Jsp's are based on servlet technology means jsps are nothing but servlets.when we write a JSP and is deployed on a webcontainer the webcontainer internally uses a jspc(jsp compiler) and generates a .java class(which is nothing but a servlet). Coming to the point of why to use servlets when we have jsps. 1) In the above paragraph as i have said that a jsp will be ultimatly converted as a servlet .The webcontainer need to spend some amount of time for doing itwhich reduces the performance of the webcontainer.So when have to write lot of java code in order to improve the performance we should use servlets. 2) When the jsps are compiled to .java files a lot of code will be generated whether it is necessary or not to have the required code we can go with servlets. 3) with jsps we need not write lot of code as the necessary code will be generated my the web container there by making the developer to easily develop the applications who has minimum amount of knowledge. 4) A person without any knowledge of java can complete the task with jsps as jsps uses html.So a person without any knowledge of java can be handled the task of developing the screens and a java developer can be involved in developing the java related stuff.As a result the project development will be done in less amount of time. 5) A java developer will charge more amount of money compared to a html developer. JSP are built using html .A developer who has no idea about coding in java can use jsps.So during the development of real time project the work load can be distributed |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|