What are the elements in JSP?

What are the elements in JSP?

Ninja Asked on 18th September 2018 in Jsp.
Add Comment
1 Answer(s)
Best answer

The elements in JSP are:

  1. JSP Scripting Elements : JSP scripting elements are written inside <% %> tags. The code inside <% %> tags are processed by the JSP engine during the translation phase of the JSP. There are three forms:
    1. Expression – <%= Java expression %>, the expression is evaluated and inserted into output
    2. Scriptlet – <% code %>, which goes into the service method of the servlet generated
    3. Declarations – <%! code %>, the code is inserted into the body of the servlet class outside of the methods
  1. JSP Comments : Used to write a comment in JSP page. The comments are hidden and removed during the translation phase. Represented in the form <%– This is a comment –%>. An alternative way to place a comment in JSP is to use the comment mechanism of the scripting language in the form <% /** This is a comment … **/ %>
  1. JSP Directives : JSP Directives are used to give special instruction to container for translation of JSP to Servlet code. JSP Directives are placed between <%@ %>. JSP provides three directives:
    1. page directive – <%@ page …. %>
    2. include directive –  <%@ include …. %>
    3. taglib directive-  <%@ taglib …. %>
  1. Standard Action Tags : JSP specification provides a set of standard JSP tags for use within JSP pages. These tags are used to eliminate the usage of scriptlet and simplify JSP page development and maintenance.  All the standard actions in JSP has a default prefix “jsp”.
  1. Custom Action Tags : JSP technology provides a mechanism for encapsulating other types of dynamic functionality in custom tags, which are extensions to the JSP language. User defined tags in JSP are known as custom action tags or custom tags. Custom tags increase productivity because they can be reused in more than one application. Custom tags are distributed in the form of a tag library.
Ninja Answered on 18th September 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.