Reputation: 4141
I want to generate html table in my jsp witch display values selected before submitting to allow user to know what did he puts into the form.
So I finish the form when submitting the values are inserted in database. Now I search the possibility to display in the same jsp of the form the table having all the values selected. So it is possible ton allow to actions in the form tag to insert and display from database at the same time.
Many Thanks for your help.
Upvotes: 0
Views: 1627
Reputation: 1108692
Yes, it is doable. If you'd like to reuse input elements, just redisplay the value in their value
attributes. E.g.
<input type="text" name="foo" value="${fn:escapeXml(bean.foo)}" />
The JSTL fn:escapeXml()
is by the way there to prevent XSS attacks.
If you'd rather like to display them plain text, then you can use JSTL c:if
or c:choose
to render HTML conditionally. E.g.
<c:if test="${editmode}">
<input type="text" name="foo" />
</c:if>
<c:if test="${!editmode}">
${fn:escapeXml(bean.foo)}
</c:if>
Here editmode
is of course a boolean
representing the edit mode.
Upvotes: 1