Web / JSP interview questions
1. How do I find or compare collection size using JSTL?
JSTL functions library (fn) could be used to find the size or compare size of the collection. for e.g. Items found.
2. if-else option in JSTL.
3. How do I test if a string contains the given value in EL?
Use the fn:contains() or fn:containsIgnoreCase() function. ${eachItem} doesn't contain 'Egg'
4. How do I access session scoped attributes in JSP?
Using the below scriptlet in JSP, the session attributes can be accessed. < %=request.getSession().getAttribute("sessionVariable")%> Also the session attributes could be accessed using JSTL and Expression Language tag as shown below.
5. What is Java Server Page (JSP)?
A Java Server Page (JSP) is a web page that contains two types of text: static data and JSP elements. Static data can be expressed in any text-based format, such as HTML or XML. JSP is a technology that mixes static content with dynamically-generated content.
6. Are JSP expressions evaluated inside a HTML comment on JSP page?
Yes, the JSP expressions will be resolved.