Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring model attribute/jsp not visible
    text
    copied!<p>Learning spring + jsp.</p> <p>I am setting a model attribute in a method in a controller</p> <pre><code>@RequestMapping("/viewExpenses") public String viewAllExpenses(Model model){ List&lt;Expense&gt; expenses; expenses = expenseService.getAllExpenses(); model.addAttribute(expenses); for(Expense e : expenses) System.out.println(e); return "viewExpenses"; } </code></pre> <p>where expenses size is > 1</p> <pre><code>Following is my jsp page: &lt;%@ taglib prefix="s" uri="http://www.springframework.org/tags"%&gt; &lt;%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%&gt; &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Home Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt; Hello ${user.firstName} &lt;br&gt; &lt;a href="homepage"&gt;HOME&lt;/a&gt; &lt;/h2&gt; &lt;div&gt;All Expenses&lt;/div&gt; &lt;span style=""&gt;&lt;/span&gt; &lt;c:forEach var="expense" items="${expenses}"&gt; &lt;c:out value="${expense.expenseId}"&gt;&lt;/c:out&gt; &lt;c:out value="${expense.expenseName}"&gt;&lt;/c:out&gt; &lt;c:out value="${expense.expenseType}"&gt;&lt;/c:out&gt; &lt;c:out value="${expense.expensePrice}"&gt;&lt;/c:out&gt; &lt;c:out value="${expense.purchaseDate}"&gt;&lt;/c:out&gt; &lt;c:out value="${expense.expenseComments}"&gt;&lt;/c:out&gt; &lt;/c:forEach&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Following is my output from the jsp(no errors): Hello Pravat HOME All Expenses</p> <p>I wonder why the expenses are not populated in my jsp</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload