
Previous to JSP, we have to use Servlet to create dynamic web application but it consists presentation logic and business logic on the same page and JSP made it easier by separating designing and development code so JSP is much easier to maintain and use comparison to Servlet.
Lets understand JSP with a simple example :
jspFirst.jsp
JSP page uses .jsp as an extension like .html for html page. In the example for static code html tags are being used and for dynamic code scriplet tag <% %> is being used which will be discussed in the upcoming tutorials.
<html>
<body>
<% out.print(“My first JSP page”); %>
</body>
</html>
This code will give “My first JSP page” as an output on web browser.Advantages of JSP :
1. JSP provides implicit objects, Action tags, JSTL, expression language, custom tags which helps programmer to write less code than Servlet.
2. JSP separates Presentation and development code which makes it easy to read, maintain and use.
3. JSP can use all the addition features with all the servlet features.
No comments:
Post a Comment