Want to shift your career to JSTL (JSP Standard Tag Library)? Then we in Wisdomjobs provide the complete information about where to apply for the JSTL (JSP Standard Tag Library) jobs on our site page as well as a different kind of job roles that we have in JSTL (JSP Standard Tag Library). To clear an interview, one must prepare well for the interview. There are many leading companies that offer job role like Senior Software Engineer, JavaDeveloper, Knowledge of performance tuning client-application code JSP, JSTL and many other roles too. One must work hard to clear any job it in first attempt. So simply to save your time we have provided all the necessary details about JSTL (JSP Standard Tag Library) Interview Questions and Answers and also various job role at one place.
Answer :
The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.
Answer :
JSP - The taglib Directive. Advertisements. The JavaServer Pages API allows you to define custom JSP tags that look like HTML or XML tags and a tag library is a set of user-defined tags that implement custom behavior. ... When you use a custom tag, it is typically of the form <prefix:tagname>.
Question 3. What Is A Tag Library?
Answer :
The JavaServer Pages Standard Tag Library (JSTL) is a component of the Java EE Web application development platform. It extends the JSP specification by adding a tag library of JSP tags for common tasks, such as XML data processing, conditional execution, database access, loops and internationalization.
Question 4. What Is Implicit Object?
Answer :
JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer can call them directly without being explicitly declared. JSP Implicit Objects are also called pre-defined variables.
Question 5. What Are The Advantage Of Jstl?
Answer :
Question 6. How Many Tags Are Provided By Jstl? What Are They?
Answer :
There JSTL mainly provides 5 types of tags:
Question 7. Explain Jstl Core Tags?
Answer :
JSTL Core tags provide support for iteration, conditional logic, catch exception, url, forward or redirect response etc. To use JSTL core tags, we should include it in the JSP page like below.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<pre class="prettyprint">
Question 8. Explain Function Tags?
Answer :
Function tags: JSTL Functions Tags: JSTL tags provide a number of functions that we can use to perform common operation, most of them are for String manipulation such as String Concatenation, Split String etc. Syntax to include JSTL functions in JSP page is:
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
Question 9. Explain Formatting Tags?
Answer :
Formatting tags: JSTL Formatting tags are provided for formatting of Numbers, Dates and i18n support through locales and resource bundles. We can include these jstl tags in JSP with below syntax:
<pre class="prettyprint">
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Question 10. Explain Xml Tags?
Answer :
JSTL XML Tags: JSTL XML tags are used to work with XML documents such as parsing XML, transforming XML data and XPath expressions evaluation. Syntax to include JSTL XML tags in JSP page is:
<%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
Question 11. Explain Sql Tags?
Answer :
SQL tags : JSTL SQL Tags: JSTL SQL Tags provide support for interaction with relational databases such as Oracle, MySql etc. Using JSTL SQL tags we can run database queries, we include these JSTL tags in JSP with below syntax:
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
Question 12. List Some Jstl Core Tags?
Answer :
JSTL Core Tags :
Question 13. List Some Function Tags?
Answer :
JSTL Function Tags List :
Question 14. List Some Formatting Tags?
Answer :
Formatting Tags Descriptions :
Question 15. List Some Jstl Sql Tags?
Answer :
Question 16. Explain Jstl If Tag With An Example?
Answer :
The if tag is a conditional tag used to evaluate conditional expressions. When a body is supplied with if tag, the body is evaluated only when the expression is true. For Example :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Tag Example</title>
</head>
<body>
<c:if test="${param.name == 'studytonight'}">
<p>Welcome to ${param.name} </p>
</c:if>
</body>
</html>
Question 17. Explain Jstl Foreach Tag With An Example?
Answer :
JSTL forEach tag: This tag provides a mechanism for iteration within a JSP page. JSTL forEach tag works similarly to enhanced for loop of Java Technology. You can use this tag to iterate over an existing collection of items. For Example :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Tag Example</title>
</head>
<body>
<c:forEach var="message" items="${errorMsgs}" >
<li>${message}</li>
</c:forEach>
</body>
</html>
Here the attribute items has its value as an EL expression which is a collection of error messages. Each item in the iteration will be stored in a variable called message which will be available in the body of the forEach tag.
Question 18. Explain Jstl Catch Tag With An Example?
Answer :
JSTL catch tag: The JSTL catch tag is used to handle exception and doesn't forward the page to the error page. For Example :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Tag Example</title>
</head>
<body>
<c:catch>
<% int a = 0;
int b = 10;
int c = b/a;
%>
</c:catch>
</body>
</html>
Question 19. Explain Jstl Choose, When, Otherwise Tag With An Example?
Answer :
JSTL choose, when, otherwise tag: These are conditional tags used to implement conditional operations. If the test condition of the when tag evaluates to true, then the content within when tag is evaluated, otherwise the content within the otherwise tag is evaluated.
We can also implement if-else-if construct by using multiple when tag. The when tags are mutually exclusive, that means the first when tag which evaluates to true is evaluated and then, the control exits the choose block. If none of the when condition evaluates to true, then otherwise condition is evaluated. For Example
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Tag Example</title>
</head>
<body>
<c:forEach var="tutorial" items="${MyTutorialMap}" begin="0" end="5" varStatus="status">
<c:choose>
<c:when test="${status.count %2 == 0 }">
<p> Divisible by 2 : ${tutorial.key} </p>
<br/>
</c:when>
<c:when test="${status.count %5 == 0 }">
<p > Divisible by 5 : ${tutorial.key} </p>
<br/>
</c:when>
<c:otherwise>
<p> Neither divisible by 2 nor 5 : ${tutorial.key} </p><br/>
</c:otherwise>
</c:choose>
</c:forEach>
</body>
</html>
Question 20. Explain Jstl Out Tag?
Answer :
JSTL out tag: The out tag is used to evaluate an expression and write the result to JspWriter. For Example :
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Tag Example</title>
</head>
<body>
<c:out value="${param.name}" default="StudyTonight" />
</body>
</html>
The value attribute specifies the expression to be written to the JspWriter. The default attribute specifies the value to be written if the expression evaluates null.
JSTL(JSP Standard Tag Library) Related Tutorials |
|
---|---|
Java Script Tutorial | Core Java Tutorial |
AJAX Tutorial | JSP Tutorial |
Hibernate Tutorial | MVC Framework Tutorial |
JavaMail API Tutorial | Spring MVC Framework Tutorial |
JSTL(JSP Standard Tag Library) Related Practice Tests |
|
---|---|
Java Script Practice Tests | Core Java Practice Tests |
AJAX Practice Tests | JSP Practice Tests |
Hibernate Practice Tests | Spring MVC Framework Practice Tests |
Jstl(jsp Standard Tag Library) Practice Test
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.