JSP Elements
JSP page is converted to Servlet java class. Therefore following elements in JSP will be copied in Servelet. Suppose there is a JSP page named "DisplayCounter.jsp". It will be converted to DisplayCounter_jsp class when it is placed in container. DisplayCounter_jsp will be extended from HttpServlet. Inside this class _jspService() method will be created and all the java code will be populated there.
- Directives
Page directive<%@ page import="java.util.*" %>
Page directive defines page-spacific properties such as character encoding, the content type, whether this page should have the implicit session object.
Attributes in page directives are- import
- isThreadSafe
- contentType
- isELIgnored
- isErrorPage
- errorPage
Taglib directive<%@ taglib tagdir="/WEB-INF/tags/cool" prefix="cool" %>
It defines tag libraries available to the JSP.Include directive<%@ include file="wickedHeader.html" %>
It defines text and code that gets added into the current page at translation time. This lets you build reusable chunks withou having to duplicate all that code in each JSP. - Declaration
<%! int count=0; %>
Declare count will be a member variable. You can define method or member variable. - Scriptlet
<% out.println(count); %>
Inside the scriptlet, you can write java code which will be copeid to converted servelet. - Expression
<%=count+1 %> - Jsp Comment
`<%-- --%>
No comments:
Post a Comment