Get all parameters from JSP page

<%@ page import = “java.util.Map” %> Map<String, String[]> parameters = request.getParameterMap(); for(String parameter : parameters.keySet()) { if(parameter.toLowerCase().startsWith(“question”)) { String[] values = parameters.get(parameter); //your code here } }

difference between eq and == in JSP

eq exists (as well as ne, lt, etc) so you can avoid using XML entity references (< is an XML character and would need to be escaped as &lt;, for example), but they do the same thing. See Comparison operators in JSP for more info.

The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

Get rid of any servletcontainer-specific libraries such as jsp-api.jar in your /WEB-INF/lib folder. This exception indicates that you’ve put servletcontainer-specific libraries of a container which supports only Servlet 2.4 / JSP 2.0 or older in there (the getJspApplicationContext() method was introduced in Servlet 2.5 / JSP 2.1). This is a major mistake. Those libraries don’t … Read more

Why Facelets is preferred over JSP as the view definition language from JSF 2.0 onwards?

True, JSP has some templating capabilities, but the biggest disadvantage of using JSP in JSF is that JSP writes to the response as soon as it encounters template text content, while JSF would like to do some pre/post processing with it. In JSF 1.0/1.1 the following JSF code <h:outputText value=”first”/> second <h:outputText value=”third”/> fourth would … Read more

Accessing a JSTL / EL variable inside a Scriptlet

JSTL variables are actually attributes, and by default are scoped at the page context level. As a result, if you need to access a JSTL variable value in a scriptlet, you can do so by calling the getAttribute() method on the appropriately scoped object (usually pageContext and request). resp = resp + (String)pageContext.getAttribute(“test”); Full code … Read more

What is the difference between and ?

<c:if is a simple if-clause. <c:when> has options for multiple if-clauses and an else clause. Compare: <c:if test=”${foo == ‘bar’}”>…</c:if> with <c:choose> <c:when test=”${foo == ‘bar’}”>…</c:when> <c:when test=”${foo == ‘baz’}”>…</c:when> <c:otherwise>…</c:otherwise> </c:choose>