Mithrand1r
Mithrand1r

Reputation: 2353

JSP does not display table from list of objects

I have my controller method:

    @RequestMapping(value = "/provide", method = RequestMethod.GET)
    public String list(Model model) {

        List<Questionare> provide = scs.getPending();
        logger.info("Number of questionares: "+provide.size());
        model.addAttribute("certDatas", provide);

        return "ssl/provide";
    }

I have added logger.info in order to check if my list is being correctly created. It is. My logger log info such as :

2014-07-04 09:46:04,118 INFO [pl.test.QuestionareControler] Number of questionares: 163

Now I want to display those 163 object in my jsp page in form of table like this:

<c:if test="${not empty provide}">
                <table class="grid" style="width: 850px;">
                    <tr>
                        <th style="width: 100px;">Name</th>
                        <th style="width: 100px;">Surname</th>
                        <th style="width: 100px;">email</th>

                    </tr>
                    <c:forEach var="person" items="${provide}">
                        <%
                            i++;
                        %>
                        <tr>
                            <td>${person.name}</td>
                            <td>${person.suername}</td>
                            <td>${person.smtp}</td>

                    </c:forEach>
                </table>
</c:if>

However my jsp page does not show that table (I mean if condition is not met I suppose, because I do not even see table header)

Can anyone give me a hint what am I doing wrong?

Upvotes: 1

Views: 1003

Answers (1)

Mohsan Shakir
Mohsan Shakir

Reputation: 64

Your model is called certDatas and not provide. Try this:

<c:if test="${certDatas != null}">

Check out the JSP expression language here: http://www.tutorialspoint.com/jsp/jsp_expression_language.htm

Upvotes: 1

Related Questions