【发布时间】:2015-01-03 05:05:53
【问题描述】:
这是我的jsp中的表单:
<form id="withdrawFromAccountForm" action="${pageContext.request.contextPath}/ActionServlet" method="post" enctype="text/plain">
<input type="hidden" name="jspId" value="viewClientDetails" />
<input type="submit" class="submit" value="Enter" />
</form>
这是我的 servlet 中的代码:
String whatJsp = request.getParameter("jspId");
if (whatJsp.equals("viewClientDetails"))
{
//code ..
}
当我点击 JSP 中的提交按钮时,servlet 转到检查的 if 语句 如果 jsp 是带有隐藏输入的“viewClientDetails” jsp,但该输入给出 null ...
有人知道问题出在哪里吗? 谢谢。
【问题讨论】:
-
您是如何阅读该输入的?请说明
whatJsp是如何初始化的。 -
我编辑了它。现在你可以看到了。
-
你为什么在你的
<form>中使用enctype="text/plain"? -
好的,我刚刚删除了 enctype="text/plain" 并且它起作用了..