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?
Ans: 2- Vector.
Question 3.) The set Secure (Boolean) method of the Cookie class is used to:
- Encrypt a cookie so that the user can not read the stored cookies.
- Specify whether the cookie is sent over a secure protocol such as SSL.
- Specify whether the cookie is not violating any security rules.
- Gather security related information about a user.
Question 4.) Which element enables JSP to integrate with JavaBeans?
Question 5.) Can a interface be implemented in a jsp file?
Only when static pages are included.
Only when dynamic pages are included.
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