YouTube Icon

Interview Questions.

Top 100+ Jstl(jsp Standard Tag Library) Interview Questions And Answers - May 31, 2020

fluid

Top 100+ Jstl(jsp Standard Tag Library) Interview Questions And Answers

Question 1. What Is Jstl?

Answer :

The JavaServer Pages Standard Tag Library (JSTL) is a collection of beneficial JSP tags which encapsulates center capability not unusual to many JSP applications. JSTL has support for common, structural duties consisting of new release and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.

Question 2. What Is A Taglib?

Answer :

JSP - The taglib Directive. Advertisements. The JavaServer Pages API lets in you to define custom JSP tags that look like HTML or XML tags and a tag library is a fixed of user-defined tags that enforce custom behavior. ... When you use a custom tag, it is generally of the form <prefix:tagname>.

Java Script Interview Questions
Question three. What Is A Tag Library?

Answer :

The JavaServer Pages Standard Tag Library (JSTL) is part of the Java EE Web utility development platform. It extends the JSP specification by way of including a tag library of JSP tags for common duties, including XML records 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 to be had to builders in every page and developer can call them immediately without being explicitly declared. JSP Implicit Objects are also called pre-described variables.

Java Script Tutorial
Question five. What Are The Advantage Of Jstl?

Answer :

Fast Developement JSTL affords many tags that simplifies the JSP.
Code Reusability We can use the JSTL tags in diverse pages.
No want to use scriptlet tag It avoids the use of scriptlet tag.
Core Java Interview Questions
Question 6. How Many Tags Are Provided By Jstl? What Are They?

Answer :

There JSTL mainly presents five forms of tags:

Core tags.
Function tags.
Formatting tags.
XML tags.
SQL tags.
Question 7. Explain Jstl Core Tags?

Answer :

JSTL Core tags offer aid for new release, conditional common sense, seize exception, url, forward or redirect reaction and so forth. To use JSTL core tags, we have to encompass it in the JSP page like under.

<%@ taglib uri="http://java.Sun.Com/jsp/jstl/core" prefix="c" %>
<pre class="prettyprint">

Core Java Tutorial AJAX Interview Questions
Question eight. Explain Function Tags?

Answer :

Function tags: JSTL Functions Tags: JSTL tags provide some of features that we will use to perform commonplace operation, maximum of them are for String manipulation such as String Concatenation, Split String and many others. Syntax to encompass JSTL features 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 help via locales and aid bundles. We can encompass those jstl tags in JSP with under syntax:

<pre class="prettyprint">

<%@ taglib uri="http://java.Sun.Com/jsp/jstl/fmt" prefix="fmt" %>

JSP Interview Questions
Question 10. Explain Xml Tags?

Answer :

JSTL XML Tags: JSTL XML tags are used to work with XML files including parsing XML, remodeling XML records and XPath expressions evaluation. Syntax to encompass JSTL XML tags in JSP web page is:

<%@ taglib uri="http://java.Sun.Com/jsp/jstl/xml" prefix="x" %>

AJAX Tutorial
Question 11. Explain Sql Tags?

Answer :

SQL tags : JSTL SQL Tags: JSTL SQL Tags offer assist for interplay with relational databases together with Oracle, MySql and many others. Using JSTL SQL tags we will run database queries, we consist of these JSTL tags in JSP with below syntax:

<%@ taglib uri="http://java.Sun.Com/jsp/jstl/sql" prefix="sql" %>

Hibernate Interview Questions
Question 12. List Some Jstl Core Tags?

Answer :

JSTL Core Tags :

<c:out> : To write some thing in JSP page, we will use EL additionally with this tag.
<c:import> : Same as <jsp:include> or consist of directive.
<c:redirect> : redirect request to some other useful resource.
<c:set> : To set the variable cost in given scope.
<c:remove> : To remove the variable from given scope.
<c:catch> : To capture the exception and wrap it into an item.
<c:if> : Simple conditional good judgment, used with EL and we will use it to process the exception from <c:catch>.
<c:choose> : Simple conditional tag that establishes a context for mutually exclusive conditional operations, marked through <c:when> and <c:otherwise>.
<c:when> : Subtag of <c:choose> that includes its frame if its condition evalutes to 'proper'.
<c:otherwise> : Subtag of <c:choose> that consists of its body if its circumstance evalutes to 'false'.
Java Script Interview Questions
Question thirteen. List Some Function Tags?

Answer :

JSTL Function Tags List :


fn:includes() : It is used to check if an input string containing the desired substring in a program.
Fn:containsIgnoreCase() : It is used to test if an enter string incorporates the required substring as a case insensitive way.
Fn:endsWith() : It is used to check if an input string ends with the desired suffix.
Fn:escapeXml() :  It escapes the characters that might be interpreted as XML markup.
Fn:indexOf() : It returns an index within a string of first incidence of a unique substring.
Fn:trim() : It gets rid of the blank areas from each the ends of a string.
Fn:startsWith() : It is used for checking whether or not the given string is commenced with a selected string value.
Fn:cut up() : It splits the string into an array of substrings.
Fn:toLowerCase() : It converts all the characters of a string to decrease case.
Fn:toUpperCase() : It converts all the characters of a string to higher case.
 

 

 

JSP Tutorial
Question 14. List Some Formatting Tags?

Answer :

Formatting Tags Descriptions :

fmt:parseNumber : It is used to Parses the string illustration of a foreign money, percentage or range.
Fmt:timeZone : It specifies a parsing movement nested in its body or the time zone for any time formatting.
Fmt:formatNumber : It is used to format the numerical value with unique format or precision.
Fmt:parseDate : It parses the string illustration of a time and date.
Fmt:bundle : It is used for growing the ResourceBundle items so one can be utilized by their tag body.
Fmt:setTimeZone : It shops the time quarter inside a time sector configuration variable.
Fmt:setBundle : It masses the resource package deal and stores it in a package configuration variable or the named scoped variable.
Fmt:message : It show an internationalized message.
Fmt:formatDate : It codecs the time and/or date the usage of the supplied sample and styles.
Question 15. List Some Jstl Sql Tags?

Answer :

sq.:setDataSource: It is used for creating a simple records supply suitable most effective for prototyping.
Sq.:question: It is used for executing the SQL question defined in its sq. Characteristic or the body.
Sq.:update: It is used for executing the SQL update described in its sq. Characteristic or within the tag frame.
Sq.:param: It is used for units the parameter in an SQL statement to the required value.
Sq.:dateParam: It is used for units the parameter in an SQL statement to a specific java.Util.Date cost.
Square:transaction:  It is used to offer the nested database motion with a not unusual connection.
MVC Framework Interview Questions
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 provided with if tag, the body is evaluated simplest while 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.Call </p>
    </c:if>
  </body>
</html>

Hibernate Tutorial
Question 17. Explain Jstl Foreach Tag With An Example?

Answer :

JSTL forEach tag: This tag gives a mechanism for iteration within a JSP web page. JSTL forEach tag works in addition to more desirable for loop of Java Technology. You can use this tag to iterate over an existing series of gadgets. 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 objects has its price as an EL expression that's a set of blunders messages. Each object inside the new release might be stored in a variable called message so that it will be available in the body of the forEach tag.

JavaMail API Interview Questions
Question 18. Explain Jstl Catch Tag With An Example?

Answer :

JSTL seize tag: The JSTL capture tag is used to deal with exception and does not ahead the web page to the mistake web 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>

Core Java Interview Questions
Question 19. Explain Jstl Choose, When, Otherwise Tag With An Example?

Answer :

JSTL choose, while, in any other case tag: These are conditional tags used to put in force conditional operations. If the take a look at situation of the when tag evaluates to true, then the content inside whilst tag is evaluated, otherwise the content material inside the otherwise tag is evaluated.

We can also enforce if-else-if construct by the use of a couple of while tag. The while tags are mutually extraordinary, meaning the primary while tag which evaluates to genuine is evaluated and then, the control exits the pick out block. If none of the whilst condition evaluates to authentic, then in any other case 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 via 2 : $educational.Key </p>
 <br/>
        </c:when>
        <c:when test="$status.Count %5 == 0 ">
 <p > Divisible by using 5 : $educational.Key </p>
 <br/>
        </c:when>
        <c:otherwise>
 <p> Neither divisible through 2 nor five : $educational.Key </p><br/>
        </c:otherwise>
     </c:choose>
    </c:forEach>
  </body>
</html>

MVC Framework Tutorial
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 fee attribute specifies the expression to be written to the JspWriter. The default characteristic specifies the fee to be written if the expression evaluates null.

Java EE Connector Architecture (JCA) Interview Questions




CFG