gpt4 book ai didi

java - 如何在请求后刷新表单?

转载 作者:行者123 更新时间:2023-12-01 15:37:09 24 4
gpt4 key购买 nike

我有一个可以更改数据库中的值的表单(true->false 或 false->true)。点击按钮后,值发生更改,用户被重定向到同一页面,但 JSTL 显示的旧值仍然存在。

${名称}

<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>

我尝试在页面中添加这些行,但没有成功:

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

最佳答案

您只需要更新 JSTL 显示的值,它可能位于 session /页面/请求/应用程序范围内。您还需要更新它们,然后 JSTL 将显示更新后的值

关于java - 如何在请求后刷新表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8700543/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com