【问题标题】:how to get values from jsp如何从jsp中获取值
【发布时间】:2011-01-03 07:36:03
【问题描述】:

在我的 jsp 中,我使用 enctype="multipart/form-data" 形式的文件上传,并在另一个 jsp 中获取表单值。我得到空值。请...任何人告诉任何解决方案..提前谢谢.. 听说是我的jsp编码

<html>
<head></head>
<body>
<form name="corporateProfile" method="POST"
 onsubmit="return checkTheFields();" action="editUpdate.jsp"
 enctype="multipart/form-data">
<table>
  <tr>
      <td class="bgcolor" align="right" valign="top" style="padding:3px">
          <b>Upload Customer Logo</b></td>
      <td colspan="3" class="bgcolor" align="left" valign="top"
           style="padding:3px">
          <input TYPE="file" VALUE="Browse" NAME="uploadCustomerLogo"
           maxlength="1000" size="40" class="controlStyle" tabindex="17">
      </td> 
  </tr>
  <tr>
      <td>
          <input type="text" name="email" id="email" size="40"
           class="controlStyle" maxlength="256" tabindex="11">
      </td>
  </tr>
</table>

</body>
</form>
</html>

editUpdate.jsp

<%
String params  = request.getParamater("email");
out.println(params);
%>

输出给出

null

【问题讨论】:

    标签: java jsp


    【解决方案1】:

    getParameter 在多部分表单上将返回 null。 here 列出了 4 个解决方案。

    【讨论】:

      【解决方案2】:

      &lt; form &gt;标签一个id

      <form name="corporateProfile" id="corporateProfile"
      

      然后试试request.getParamater("email");

      【讨论】:

        猜你喜欢
        • 2014-06-14
        • 1970-01-01
        • 2016-05-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-07-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多