JSP Action Tags & JSTL (JSP Standard Tag Library)
The list of standard JSP action elements are given below.+
JSP ACTION | DESCRIPTION |
---|---|
jsp:include | To include a resource at runtime, can be HTML, JSP or any other file |
jsp:useBean | To get the java bean object from given scope or to create a new object of java bean. |
jsp:getProperty | To get the property of a java bean, used with jsp:useBean action. |
jsp:setProperty | To set the property of a java bean object, used with jsp:useBean action. |
jsp:forward | To forward the request to another resource. |
jsp:text | To write template text in JSP page. |
jsp:element | To define the XML elements dynamically. |
jsp:attribute | To define the dynamically generated XML element attributes |
jsp:body | To define the dynamically generated XML element body |
jsp:plugin | To generate the browser-specific code that makes an OBJECT or EMBED tag for the Java plugin. |
Out my experience I can tell that, we mostly use jsp:include,
+
jsp:useBean and
jsp:forward
actions. jsp:setProperty and jsp:getProperty are used in jsp:useBean so I will just focus on this actions. Others are not so important from both interview perspective as well as from project development perspective. You can safely ignore it
+
include directive | jsp:include action |
---|---|
Including the file happens at Translation Time | Including the file happens at Runtime |
A copy of the original file is copied | No copy of the original file created but it refers to the original file |
Meant for static content | Meant for dynamic content |
Cannot pass parameters | Can pass parameters |
A copy of the original file is copied | No copy of the original file created but it refers to the original file |
+
+
+
+
JSTL+
+
JSTL Core Tags List
Tags | Description |
---|---|
c:out | It display the result of an expression, similar to the way <%=…%> tag work. |
c:import | It Retrives relative or an absolute URL and display the contents to either a String in ‘var’,a Reader in ‘varReader’ or the page. |
c:set | It sets the result of an expression under evaluation in a ‘scope’ variable. |
c:remove | It is used for removing the specified scoped variable from a particular scope. |
c:catch | It is used for Catches any Throwable exceptions that occurs in the body. |
c:if | It is conditional tag used for testing the condition and display the body content only if the expression evaluates is true. |
c:choose, c:when, c:otherwise | It is the simple conditional tag that includes its body content if the evaluated condition is true. |
c:forEach | It is the basic iteration tag. It repeats the nested body content for fixed number of times or over collection. |
c:forTokens | It iterates over tokens which is separated by the supplied delimeters. |
c:param | It adds a parameter in a containing ‘import’ tag’s URL. |
c:redirect | It redirects the browser to a new URL and supports the context-relative URLs. |
c:url | It creates a URL with optional query parameters. |
Comments
Post a Comment