N
N
NightFantom2014-07-23 18:14:17
Java
NightFantom, 2014-07-23 18:14:17

What is wrong with jsp?

I have code:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
....
<logic:iterate id="user" name="Records" property="users">
        <tr>
            <td><bean:write name="user" property="from"/></td>
            <td><bean:write name="user" property="where"/></td>
                <%--<td><bean:write name="user" property="day" format=""/></td>--%>
            <td>               
  1)          <c:set var = "day" value = "${user.getDay()}" scope="session"></c:set>
                <c:choose>
                    <c:when test="day != 0">
                        <bean:write name="user" property="day" format=""/>
                    </c:when>
                    <c:otherwise>
                        ${pageScope.day}
                    </c:otherwise>
                </c:choose>
            </td>
            <td><bean:write name="user" property="month" format=""/></td>
            <td><a href="<bean:write name="user" property="vkId"/>"> VK</a></td>
            <td><bean:write name="user" property="comment"/></td>
        </tr>
    </logic:iterate>

The problem is that nothing is entered in day (point 1)! What's wrong here?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Khabarov, 2014-08-01
@ehabarov

1. Preferably use a different taglib declaration
2. Try like this:
The Expression Language in JSP itself understands what to call, according to the JavaBeans specification.
Those. in the user class, this can be both a public field named day and a getter method like getDay().
Read more: read the JSP Expression Language specification.
The Java EE 6 Tutorial : Overview of the EL

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question