我的页面
<form id="conForm" action="${pageContext.request.contextPath}/addContact" method="post" enctype="multipart/form-data">
<dl>
<dt><label for="address_group_name">群组名称</label>:</dt>
<dd><input id="address_group_name" name="name" type="text"/><span id="nameError" class="valid"></span></dd>
<dt><label for="address_group_file">新号码文件</label>:</dt>
<dd class="multline"><input id="address_group_file" name="filePath" type="file" />
<input id="fileName" name="fileName" type="hidden"/>
<span id="filePathError" class="valid"></span>
<div>每行一条联系人记录,目前只包含号码信息,后期支持多维信息扩展,用半角逗号分隔,例如:“号码,姓名,邮箱,备注”</div>
</dd>
</dl>
<div class="cmd"><input type="submit" class="button-orange" value="保存修改" onclick="return addContact()"/> <input type="button" onclick="location.href='${pageContext.request.contextPath }/findByPage';" class="button-orange" value="返 回" /></div>
</form>
$('#conForm').ajaxForm({
dataType:"json",
success:function(data)
{
alert(data.result);
if(data.result == "0")
{
location.href = "${pageContext.request.contextPath}/findByPage";
}else{
return false;
}
}
});