在表单中使用post方法时出现错误

发布于 2024-08-02 13:57:05 字数 1050 浏览 4 评论 0原文

当我在将表单传递到下一页时使用 post 方法时,我得到 null 重复这个问题 链接文本

<html>
<head>
Title
<script>
function callme()
{        
alert("Hi");         
alert(document.getElementById("prio").value);       
}
</script>   
</head>
<body>
<FORM method="post" name="test"enctype="multipart/form-data" action="testjsp.jsp" >
<select name="prio" id="prio"> 
<option>1</option>
<option>2</option>
</select>
<input type="submit" value="Submit" onClick=callme();>
</form>
</body>
</html>

在 testjsp.jsp 中,我正在尝试打印我的 prio 变量我无法做到并且其打印为空。我只想访问其他服务器端组件中的变量 prio 并且还想使用 post 方法。

<html>
<head>
Title  
</head>
<body>
<%
String prio=request.getParameter("prio");
out.println("the value of prio is"+prio);
%>

</body>
</html>

这与幂等属性有什么关系吗? 我很困惑为什么我无法访问 testjsp 页面中的变量 prio 。

I am getting null when I am using post method while passing a form to the next page
A repeat of this question
link text

<html>
<head>
Title
<script>
function callme()
{        
alert("Hi");         
alert(document.getElementById("prio").value);       
}
</script>   
</head>
<body>
<FORM method="post" name="test"enctype="multipart/form-data" action="testjsp.jsp" >
<select name="prio" id="prio"> 
<option>1</option>
<option>2</option>
</select>
<input type="submit" value="Submit" onClick=callme();>
</form>
</body>
</html>

IN testjsp.jsp I am trying to prin the prio variable which I am not able to do and its prining null.I just want to access the variable prio in some other server side component and also want to use post method.

<html>
<head>
Title  
</head>
<body>
<%
String prio=request.getParameter("prio");
out.println("the value of prio is"+prio);
%>

</body>
</html>

Is this any way related to Idempotent property?
I am confused why I could not access the variable prio in the testjsp page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め七分饶幸 2024-08-09 13:57:05

您将请求编码为 multipart/form-data,通常用于上传文件。 servlet 容器不支持自动解码此数据,仅支持 application/x-www-form-urlencoded 数据(默认)。要使用 multipart/form-data 你需要一个第三方 MIME 解析器,例如 Apache commons fileUpload

You are encoding your request as multipart/form-data, often used to upload files. The servlet container does not include support to automatically decode this data, only application/x-www-form-urlencoded data (the default). To use multipart/form-data you need a 3rd party MIME parser like Apache commons fileUpload.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文