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

JSP11.What are JSP expressions?
A JSP expression element contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file.

The expression element can contain any expression that is valid according to the Java Language Specification but you cannot use a semicolon to end an expression.

Its syntax is:

<%= expression %>

12.What are JSP comments?
JSP comment marks text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or “comment out” part of your JSP page.

Following is the syntax of JSP comments:

<%– This is JSP comment –%>

13.What are JSP Directives?
A JSP directive affects the overall structure of the servlet class. It usually has the following form:

<%@ directive attribute=”value” %>

14.What are the types of directive tags?
The types directive tags are as follows:

<%@ page … %> : Defines page-dependent attributes, such as scripting language, error page, and buffering requirements.

<%@ include … %> : Includes a file during the translation phase.

<%@ taglib … %> : Declares a tag library, containing custom actions, used in the page.

15.What are JSP actions?
JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.

Its syntax is as follows:

<jsp:action_name attribute=”value” />

16.Name some JSP actions.
jsp:include, jsp:useBean,jsp:setProperty,jsp:getProperty, jsp:forward,jsp:plugin,jsp:element, jsp:attribute, jsp:body, jsp:text

17.What are JSP literals?
Literals are the values, such as a number or a text string, that are written literally as part of a program code. The JSP expression language defines the following literals:

Boolean: true and false

Integer: as in Java

Floating point: as in Java

String: with single and double quotes; ” is escaped as \”, ‘ is escaped as \’, and \ is escaped as \\.

Null: null

18.What is a page directive?
The page directive is used to provide instructions to the container that pertain to the current JSP page. You may code page directives anywhere in your JSP page.

19.What are various attributes Of page directive?
Page directive contains the following 13 attributes.

language

extends

import

session

isThreadSafe

info

errorPage

isErrorpage

contentType

isELIgnored

buffer

autoFlush

isScriptingEnabled

20.What is a buffer attribute?
The buffer attribute specifies buffering characteristics for the server output response object.

You may also like

Leave a Comment