Enrichman
Enrichman

Reputation: 11337

How to refresh a form after a request?

I've a form that change a value in the database (true->false or false->true). After the hitting of the button the value is changed, the user is redirected on the same page but the old value showed by the JSTL is still there.

${name}

<c:choose>

    <c:when test="${is_active}">

    <form action="deactive.do" method="post">
        <input type="hidden" name="id" value="${id}"/>
        <span style='color:red;'>active</span> - 
        <input type="submit" value="DEACTIVE" name="deactive">
    </form>

    </c:when>
    <c:otherwise>

    <form action="active.do" method="post">
        <input type="hidden" name="id" value="${id}"/>
        <span style='color:red;'>NOT ACTIVE</span> - 
        <input type="submit" value="ACTIVE" name="active">
    </form>

    </c:otherwise>
</c:choose>

I've tried with adding these lines in the page but didn't worked:

<% response.setHeader("Cache-Control","no-store"); 
   response.setHeader("Pragma","no-cache"); 
   response.setDateHeader ("Expires", 0); %>

Upvotes: 0

Views: 648

Answers (1)

Jigar Joshi
Jigar Joshi

Reputation: 240966

You just need to update the values that is being shown by JSTL, may be it is there in session/page/request/application scope. you need to update them as well then JSTL will show updated value

Upvotes: 1

Related Questions