InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 101. |
What are JSP Directives? |
|
Answer» A JSP directive affects the overall structure of the servlet class. It usually has the following form − <% directive attribute = "value" %> |
|
| 102. |
What are JSP comments? |
|
Answer» 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 --%> |
|
| 103. |
What are JSP expressions? |
|
Answer» 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 %> |
|
| 104. |
What are JSP declarations? |
|
Answer» A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file. <%! declaration; [ declaration; ]+ ... %> |
|
| 105. |
What is a sciptlet in JSP and what is its syntax? |
|
Answer» A scriptlet can contain any number of JAVA language statements, variable or method declarations, or expressions that are valid in the page scripting language. Following is the syntax of Scriptlet − <% code fragment %> |
|
| 106. |
Explain lifecycle of a JSP. |
|
Answer» A JSP Lifecycle consists of following steps −
|
|
| 107. |
What are the advantages of JSP over Static HTML? |
|
Answer» Regular HTML, of course, cannot contain dynamic information. |
|
| 108. |
What are the advantages of JSP over JavaScript? |
|
Answer» JavaScript can generate HTML dynamically on the client but can hardly interact with the web server to perform complex tasks like database access and image processing etc. |
|
| 109. |
What are the advantages of JSP over Server-Side Includes (SSI)? |
|
Answer» SSI is really only intended for simple inclusions, not for "real" programs that use form data, make database connections, and the like. |
|
| 110. |
What are the advantages of JSP over Pure Servlets? |
|
Answer» It is more convenient to write (and to modify!) regular HTML than to have plenty of println statements that generate the HTML. Other advantages are −
|
|
| 111. |
What are the advantages of JSP over Active Server Pages (ASP)? |
|
Answer» The advantages of JSP are twofold. First, the dynamic part is written in Java, not Visual Basic or other MS specific language, so it is more powerful and easier to use. Second, it is portable to other operating systems and non-Microsoft Web servers. |
|
| 112. |
What are advantages of using JSP? |
|
Answer» JSP offer several advantages as listed below −
|
|