Javascript 如何获得价值<;选择>;使用Servlet?
当我使用request.getParameter(“itemSelect”)时,它返回“null”,因为enctype=“multipart/formdata”。如果我删除这个属性,我可以不使用JQuery只使用HTML和Servlet获取值,这样Javascript 如何获得价值<;选择>;使用Servlet?,javascript,jquery,forms,servlets,Javascript,Jquery,Forms,Servlets,当我使用request.getParameter(“itemSelect”)时,它返回“null”,因为enctype=“multipart/formdata”。如果我删除这个属性,我可以不使用JQuery只使用HTML和Servlet获取值,这样。如何使用Servlet获取此表单的值 我的HTML表单: <form id="formupload" method="POST" enctype="multipart/form-data"> <select id="item
。如何使用Servlet获取此表单的值
我的HTML表单:
<form id="formupload" method="POST" enctype="multipart/form-data">
<select id="itemSelected" name="itemSelected">
</select>
<span id="btnfile" class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i>
<span>Selecionar Arquivo...</span>
<input id="file" type="file" name="files">
</span>
<button id="upload" type="submit" class="btn btn-primary" title="Adicione um arquivo para habilitar o botão.">
<i class="icon-upload icon-white"></i>
<span>Iniciar upload</span>
</button>
</form>
阿基沃赛利科纳酒店。。。
iCiar上传
JQuery函数:
$('form').ajaxForm({
url: 'url',
beforeSend: function() {
// $('#progress').append('<div class="progress"><div class="bar"></div ><div class="percent">0%</div></div>');
message.empty();
var percentVal = '0%';
bar.width(percentVal);
percent.html(percentVal);
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal);
percent.html(percentVal);
},
success: function() {
var percentVal = '100%';
bar.width(percentVal);
percent.html(percentVal);
$('table td#start0').append('<img src="img/success.png">');
},
error: function() {
$('table td#start0').append('<img src="img/error.png">');
},
complete: function(xhr) {
message.html(xhr.responseText);
}
});
}
$('form').ajaxForm({
url:'url',
beforeSend:function(){
//$(“#进度”)。追加('0%);
message.empty();
var percentVal='0%';
条形宽度(百分比值);
html(percentVal);
},
上载进度:功能(事件、位置、总数、完成百分比){
var percentVal=percentComplete+“%”;
条形宽度(百分比值);
html(percentVal);
},
成功:函数(){
var percentVal=‘100%’;
条形宽度(百分比值);
html(percentVal);
$('table td#start0')。追加('');
},
错误:函数(){
$('table td#start0')。追加('');
},
完成:函数(xhr){
message.html(xhr.responseText);
}
});
}
当使用多部分/表单数据(即上载文件)而不是使用普通的request.getParameter时,您需要使用库谢谢您的回复。是的,我使用的是commons fileupload。