csdnzlw 2016-06-06 02:57 采纳率: 0%
浏览 1155

图片上传 如何获得form里面的值

<form name="fileForm" id="fileForm" action="${pageContext.request.contextPath}/Processes?action=upLoadImg&className=SearchUploadServlet" onsubmit="return check();" method="post" enctype="multipart/form-data" >
    <table>
        <c:if test="${uploadFileName !=null}">
            <tr>
                <td>
                    <img width='200px' title="" height='200px;'  src="${pageContext.request.contextPath}/searchupload${uploadFileName }"> 
                    <p style="color:red;">${errorMessage }</p>
                </td>
            </tr>
        </c:if>
        <tr>
            <td>
                请选择上传的图片或文件:<input type="file" name="fileName" id="fileName" accept="image/jpeg,image/png,image/gif" onchange="return fnSubmit();"/>
            </td>

        </tr>
        <tr>
            <td>大类索引
                <select id="maxSelect" style="width:200px" onchange="fnSelect(this.value)" > 
                            <option selected="selected"></option>
                     <c:forEach var="largeIndexList" items="${largeIndexList}">
                        <c:if test="${maxSelectId==largeIndexList.indexName}">
                            <option value="${largeIndexList.indexName}" selected="selected">${largeIndexList.indexNameCn}</option>
                        </c:if>
                        <c:if test="${maxSelectId!=largeIndexList.indexName}">
                            <option value="${largeIndexList.indexName}">${largeIndexList.indexNameCn}</option> 
                        </c:if>
                     </c:forEach>
              </select>
              <input type="hidden" id="selectId" name ="selectId">
            </td>
            <td>
                <input  type="button" value="搜索" onclick="subMit();"/> 
                <input type="hidden" id="uploadImg" name ="uploadImg" value="${uploadFileName }">
            </td>
        </tr>
    </table> 
</form>

后台servlet如何获得selectId的值
  • 写回答

4条回答 默认 最新

  • 猫哈噗啦啦吖 2016-06-06 03:18
    关注

    在select中写name,servlet根据name可以获取option的value

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题