I am creating a simple guest book in JSP in order to learn this technology. Currently I have two classes: guestbook/GuestBook.class and guestbook/Entry.class (I haven't finished the app yet, so I have only these classes) which are added into WEB-INF/libs/ and they're included properly. In my file index.jsp I am using guestbook.GuestBook class; its method returns Vector. When I iterate over entries and I'd like to print an author of the entry, I can see:
javax.el.PropertyNotFoundException: Property 'author' not found on type guestbook.Entry
I must add that Entry class is public and author attribute is declared in such way:
public String author;
So it is public, too. This is my code when I iterate over the entries:
<c:forEach items="${entries}" varStatus="i">
<c:set var="entry" value="${entries[i.index]}" />
<li><c:out value="${entry.author}" /></li>
</c:forEach>
and
entry.class.name
returns guestbook.Entry
The classes are in package guestbook (as you can guess), entries vector is passed to pageContext.
I do not know what is wrong with my way of doing it. Can anybody help me please with that? (Thanks in advance!)
return context.getELResolver().getValue( context, base, property);
calls the samegetValue
implementation. – Inelastic