Skip navigation.
Home

How to easily dump POST values using JSTL

How can I easily dump http POST parameters using JSTL? It is super easy...

I recently created a web app that uses the following flow:

  1. show page one
  2. SUBMIT
  3. controller a
  4. DATA_MISSING
  5. show page two
  6. SUBMIT
  7. controller a
  8. OK

So I need to carry all of the data from page one to page two, but I don't want to reconstruct a massive object graph to do so.

In controller a (step #4) I use a normal jsp forward. In the jsp step #5, the following JSTL renders the hidden form elements necessary for steps #6 and #7 to work properly.


<c:forEach items="${paramValues}" var="item">
  <c:forEach var='value' items='${item.value}'>
    <input type="hidden" 
      name="<c:out value="${item.key}"/>" 
      value="<c:out value="${value}"/>"/>   
  </c:forEach>
</c:forEach>