JSTL iterate over list of objects

There is a mistake. See this line <c:forEach items=”${myList}” var=”element”>. ${} around ‘myList’ was missing. <c:forEach items=”${myList}” var=”element”> <tr> <td>${element.status}</td> <td>${element.requestType}</td> <td>${element.requestedFor}</td> <td>${element.timeSubmitted}</td> </tr> </c:forEach>

How to iterate an ArrayList inside a HashMap using JSTL?

You can use JSTL <c:forEach> tag to iterate over arrays, collections and maps. In case of arrays and collections, every iteration the var will give you just the currently iterated item right away. <%@ taglib prefix=”c” uri=”http://java.sun.com/jsp/jstl/core” %> <c:forEach items=”${collectionOrArray}” var=”item”> Item = ${item}<br> </c:forEach> In case of maps, every iteration the var will give … 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

Redirect from one controller method to another controller method

From your controller you can change the return type to be a ModelAndView and return code below. This will re-direct the request and call the controller for the new URL. return new ModelAndView(“redirect:/myURL”); Alternatively you could take in the HttpServletResponse in your controller method and return a redirect. public void myController(HttpServletResponse response){ response.sendRedirect(“/myURL”); }

How to escape apostrophe or quotes on a JSP (used by JavaScript)

I prefer to avoid scriptlets in the middle of my page and was having to use them (increasingly often) to escape strings when used in JavaScript code. I wanted an Expression Language (EL) way of escaping the strings. I created a very small custom taglib that I use for just this purpose: Utilities.java: package com.mycom.taglibs; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)