if condition within JSTL or JSP

JSTL If Condition <c:set var=”language” value=”java”/> <c:if test=”${language == ‘java’}” > you are using java language </c:if> <c:if test=”${language != ‘java’}” > you are using not java language </c:if>  JSTL…

Read More

JSTL forEach Loop Example

Maven Dependency: <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> Controller: @RequestMapping(value = “jstlForEach”, method = RequestMethod.GET) public String jstlForEach(ModelMap model) { List<Employee> employees = new ArrayList<>(); employees.add(new Employee(1, “Subhash Lamba”)); employees.add(new Employee(2,…

Read More

JSTL c:out example

JSTL Maven Dependency: <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> Controller @Controller @RequestMapping(“/”) public class HelloController { @RequestMapping(value = “out”,method = RequestMethod.GET) public String printWelcome(ModelMap model) { model.addAttribute(“message”, “Hello JSTL!”); return “out”;…

Read More