form表单上传文件后,获取成功或者失败信息
jsp部分:
<form id="add_form" action="addPerson.action" method="post" enctype="multipart/form-data" namespace="/">
<div >
<table>
<tr>
<td> </td>
<td>
<div>
<input id="eduFileName" name="eduFileName" type="text" class="input03" readonly/>
<input id="eduFile" name="eduFile" type="file" style="width:0px" onchange="onUploadImgChange(this,'edu')">
<input id="getEduFile" name="getEduFile" type="button" value="选择文件" onclick="eduFile.click();"class="btn03"/>
<p class="pic—01"><div id="eduPreviewFake"><img id="eduPreview" onload="onPreviewLoad(this)"/></div>
</p>
</div></td>
</tr>
</table>
这是一个人员添加页面,大概有40多个字段,其中6个字段需要上传图片并预览,通过submit按钮触发action,将form表单提交到后台
Java部分:
public String addPerson() throws Exception {
Staff staff=new Staff();/
String eduPath=getPath(eduFile,eduFileName);
staff.setEduPath(eduPath);
return msg;
将文件上传后,存储路径。
现在的问题是,我无法将保存成功或者失败的信息返回到前台
使用ajax不可避免的会用到上传控件,而控件会破坏我页面的样式,也就是风格不统一
大家有什么好的办法没有?