Home Interview Questions and Answers JSP Interview Questions and Answers For Graduates Part-4

JSP31.What is session attribute?
The session attribute indicates whether or not the JSP page uses HTTP sessions. A value of true means that the JSP page has access to a builtin session object and a value of false means that the JSP page cannot access the builtin session object.

32.What is isELIgnored Attribute?
The isELIgnored option gives you the ability to disable the evaluation of Expression Language (EL) expressions.

The default value of the attribute is true, meaning that expressions, ${…}, are evaluated as dictated by the JSP specification. If the attribute is set to false, then expressions are not evaluated but rather treated as static text.

33.What is isScriptingEnabled Attribute?
The isScriptingEnabled attribute determines if scripting elements are allowed for use.

The default value (true) enables scriptlets, expressions, and declarations. If the attribute’s value is set to false, a translation-time error will be raised if the JSP uses any scriptlets, expressions (non-EL), or declarations.

34.What is a include directive?
The include directive is used to includes a file during the translation phase. This directive tells the container to merge the content of other external files with the current JSP during the translation phase. You may code include directives anywhere in your JSP page.

The general usage form of this directive is as follows:

<%@ include file=”relative url” >

35.What is a taglib directive?
The taglib directive follows the following syntax:

<%@ taglib uri=”uri” prefix=”prefixOfTag”>
uri attribute value resolves to a location the container understands

prefix attribute informs a container what bits of markup are custom actions.

The taglib directive follows the following syntax:

<%@ taglib uri=”uri” prefix=”prefixOfTag” >

36.What do the id and scope attribute mean in the action elements?
Id attribute: The id attribute uniquely identifies the Action element, and allows the action to be referenced inside the JSP page. If the Action creates an instance of an object the id value can be used to reference it through the implicit object PageContext

Scope attribute: This attribute identifies the lifecycle of the Action element. The id attribute and the scope attribute are directly related, as the scope attribute determines the lifespan of the object associated with the id. The scope attribute has four possible values:

(a) page, (b)request, (c)session, and (d) application.

37.What is the function of <jsp:include> action?
This action lets you insert files into the page being generated. The syntax looks like this:

<jsp:include page=”relative URL” flush=”true” />
Where page is the the relative URL of the page to be included.

Flush is the boolean attribute the determines whether the included resource has its buffer flushed before it is included.

38.What is the difference between include action and include directive?
Unlike the include directive, which inserts the file at the time the JSP page is translated into a servlet, include action inserts the file at the time the page is requested.

39.What is <jsp:useBean> action?
The useBean action is quite versatile. It first searches for an existing object utilizing the id and scope variables. If an object is not found, it then tries to create the specified object.

The simplest way to load a bean is as follows:

<jsp:useBean id=”name” class=”package.class” />

40.What is <jsp:setProperty> action?
The setProperty action sets the properties of a Bean. The Bean must have been previously defined before this action.

You may also like

Leave a Comment