JSP(Java Server Pages) Technical Programming Interview Questions

Category > JAVA || Published on : Friday, May 15, 2015 || Views: 2686 || servlet interview questions jsp interview questions and answers jsp interview questions and answers pdf servlets and jsp interview questions and answers jsp interview questions and answers for experienced core java interview questions jdbc interview questions jsp interview questions pdf


JSP(Java Server Pages) Technical Programming Interview Questions

Question 1.) What is wrong with using JSP scriptlet tags ?

Ans: Java code embedded within scriptlet tags is ugly and obtrusive.
A non-Java developer cannot modify the embedded Java code, nullifying a major benefit of JSP: empowerment of designers and business people to update page content.
Other JSP pages cannot reuse Java code within JSP scriptlet, so common logic snippets end up being re-implemented in multiple pages.
Retrieving objects out of the HTTP request and session is cumbersome. Casting to the object’s class is required. This then requires that the object’s class be known to the JSP by importing or fully qualifying the class name.

Question 2.) Which one is thread safe?

    Arraylist
    Vector
    Map
    Table

Ans:  2- Vector.

Question 3.) The set Secure (Boolean) method of the Cookie class is used to:

  1.     Encrypt a cookie so that the user can not read the stored cookies.
  2.     Specify whether the cookie is sent over a secure protocol such as SSL.
  3.     Specify whether the cookie is not violating any security rules.
  4.     Gather security related information about a user.

Ans:  2)

Question 4.) Which element enables JSP to integrate with JavaBeans?

  1.     Scriptlets.
  2.     Directives.
  3.     Declarations.
  4.     Actions.

Ans:  4)

Question 5.) Can a interface be implemented in a jsp file?

    Yes.
    No.
    Only when static pages are included.
    Only when dynamic pages are included.

Ans:  2)

Question 6.) What is a Scriplet?

Ans: Scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language.

Question 7.) What is the purpose of Jsp forward method?

Ans: This method will forward the control to another resource available in the same web application on the same container.

Question 8.)What are the implicit objects used in JSP?

Ans:  The various implicit objects are

  1.     request
  2.     response
  3.     pageContext
  4.     session
  5.     application
  6.     out
  7.     config
  8.     page
  9.     exception

Web Development Interview Questions
Database Interview Questions
Mobile Development Interview Questions
Others Interview Questions