http - 如何知道http重定向+表单POST成功
问题描述
我的 wicket Web 应用程序正在执行表单 POST + 重定向到给定 URL。这旨在将用户重定向到该 URL,并在托管该 URL 的服务器上发布信息。是否有任何解决方案可以知道重定向成功或失败。关键是,一旦我们进行重定向,我们不知道用户是否看到了目标网页。下面是执行重定向的网页
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Redirection Page</title>
</head>
<body>
<div style="display: hidden;">
<form wicket:id="customerForm" id="redirectForm" method="post">
<input wicket:id="param1" type="hidden"/>
<input wicket:id="param2" type="hidden"/>
<input wicket:id="param3" type="hidden"/>
</form>
<script language="javascript">
document.getElementById("redirectForm").submit();
</script>
</div>
</body>
</html>
Web 应用程序使用 wicket 6.27.0 和 JEE7 开发,并托管在 Wildfly 10 中
非常感谢。
解决方案
您可以在 MyForm#onSubmit() 中的 Session 中存储一个标志,并在 GET 端点中读取+删除它。如果您的应用程序是无状态的,那么您可以使用自定义 cookie。
推荐阅读
- tooltip - Bootstrap 5 + Vue3:如何在卸载之前删除所有工具提示实例?
- sql - 存储过程清理
- testing - 测试咖啡馆未重定向到外部站点
- scala - java.lang.NoClassDefFoundError: scala/collection/convert/DecorateAsScala 但 pom.xml 中的 scala-library 使用 swagger 和 JBoss servlet
- python - 我试图从具有 100 个结果限制的 Api 获取数据,但是在使用时间戳更进一步时遇到问题
- c# - 使用 c#,为什么字母 r 和 b 被解释为标签文本中的 HTML 中断,我该如何阻止它?
- javascript - 如何通过 ajax 发布到烧瓶并更新 SQLAlchemy 数据库来删除事件 FullCalendar?
- python - 有没有办法循环回到python中某个部分代码的开头
- xml - 使用 XSLT 将节点信息更新为新值
- javascript - javascript中html内的循环函数(React)