IT Community - Software Programming, Web Development and Technical Support

Advantages of JSP over servlets

This is a discussion on Advantages of JSP over servlets within the Java Server Pages (JSP) forums, part of the Web Development category; Can anyone tell me war are all the advantages of JSP over servlets...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Java Server Pages (JSP)

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-24-2007, 04:02 AM
lavanya lavanya is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 24
lavanya is on a distinguished road
Question Advantages of JSP over servlets

Can anyone tell me war are all the advantages of JSP over servlets
__________________
Thanks,

Lavanya.J
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-30-2007, 04:48 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: Advantages of JSP over servlets

Hi Lavanya,

Java Server Pages (JSP) is basically Sun's answer to Microsoft's Active
Server Pages (ASP). They work in very similar ways. ASP allows for
VBScript, JScript, or PerlScript code to be placed in between sections
of HTML. JSP does the exact same thing only using Java as the language
of choice. Both ASP and JSP combine the design (HTML) and the code
(ASP
or JSP) in the same file.

Java Servlets are a Java equivalent of a CGI script. Like CGI it can
generate HTML, but it does not allow for HTML to live in "raw" form
within the program. Servlets can be used to process a set of
instructions and then return the values that were created by the
Servlet.

JSP also supports "Tag Libraries" These are simple tags that you embed
in your JSP, which execute java code that is stored in a separate
class. This allows you to keep your keep complex page logic
encapsulated in separate classes, while keeping your JSP pages "clean",
and free of java code. By doing this, you keep the page design in the
JSP, and the page logic elsewhere. This makes it easier to develop and
maintain your pages.

In addition to writing your own tag libraries, you can also obtain free
open-source tag libraries to perform various functions.

Hope informative,,
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-30-2007, 04:50 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default Re: Advantages of JSP over servlets

Hi lavanya,

* vs. Active Server Pages (ASP). ASP is a similar technology from Microsoft. The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS-specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers.
* vs. Pure Servlets. JSP doesn't give you anything that you couldn't in principle do with a servlet. But it is more convenient to write (and to modify!) regular HTML than to have a zillion println statements that generate the HTML. Plus, by separating the look from the content you can put different people on different tasks: your Web page design experts can build the HTML, leaving places for your servlet programmers to insert the dynamic content.
* vs. Server-Side Includes (SSI). SSI is a widely-supported technology for including externally-defined pieces into a static Web page. JSP is better because it lets you use servlets instead of a separate program to generate that dynamic part. Besides, SSI is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like.
* vs. JavaScript. JavaScript can generate HTML dynamically on the client. This is a useful capability, but only handles situations where the dynamic information is based on the client's environment. With the exception of cookies, HTTP and form submission data is not available to JavaScript. And, since it runs on the client, JavaScript can't access server-side resources like databases, catalogs, pricing information, and the like.
* vs. Static HTML. Regular HTML, of course, cannot contain dynamic information. JSP is so easy and convenient that it is quite feasible to augment HTML pages that only benefit marginally by the insertion of small amounts of dynamic data. Previously, the cost of using dynamic data would preclude its use in all but the most valuable instances.
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-21-2007, 08:38 PM
sreejiths_123 sreejiths_123 is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 1
sreejiths_123 is on a distinguished road
Default Re: Advantages of JSP over servlets

each jsp is automatically converted to servlet while executing.
advantages are..
in servlet we have to put all html code in printwriter.println() statement whrer its not needed in jsp which increses the ease of progeramming....

we can call a servelt from a jsp....
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-19-2008, 05:46 AM
saravanan saravanan is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Posts: 181
saravanan is on a distinguished road
Default Re: Advantages of JSP over servlets

1. Using jsp we can easily embeded the html coding.
--------------------------------------------------
for exmple we need to build a table using servlet
ou.println("<table>");
ou.println("<tr>");
ou.println("<td");
ou.println("User Name");
ou.println("</td>");
ou.println("<td");
ou.println("Kamala Kannan");
ou.println("</td>");
ou.println("</tr>");
ou.println("<tr>");
ou.println("<td");
ou.println("Password");
ou.println("</td>");
ou.println("<td");
ou.println("kannan");
ou.println("</td>");
ou.println("</tr");
ou.println("</table>");

but this can easily write in JSP

<table width="31%" border="1">
<tr>
<td width="35%">User Name</td>
<td width="65%">Kamala Kannan</td>
</tr>
<tr>
<td>Password</td>
<td>kannan</td>
</tr>
</table>

in jsp iits very easy to find bugs in html and java coding to
2.easy to deployment
----------------------
a.a servlets must be compiled before deploy into application
b.after compiled the class file must be placed into WEB_INF/clasess folder
if we need find hundreds of bugs, thats not possible
every time compile and deploy the class file into the application

3.There is no other difrents bcoz every JSP pages compiled into servlets
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
servlets swoosh Java Server Pages (JSP) 4 08-29-2007 05:36 AM
Advantages of VB.NET? anbuchezhians VB.NET Programming 4 08-20-2007 11:19 PM
What is the use of Servlets ? oxygen Java Programming 3 08-06-2007 11:59 PM
Advantages of 80 Pin Ide Bus itbarota Computer Hardware 0 08-06-2007 09:35 AM
What are advantages of SQL 2000 over SQl 7.0 ? sundarraja Database Support 2 08-02-2007 02:51 AM


All times are GMT -7. The time now is 01:17 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0