前端form
<form id="picForm" action="/intelligentStage-system-manage/rest/admin/addimage" method="post" enctype="multipart/form-data">
<label style="margin-top: 30px;">用户名:</label>
<input type="text" id="adminName" name="adminName" /> <br>
<img src="" id="showPhoto" style="float: right;width: 100px;height: 100px;margin-right: 40px;" />
<label>密码:</label>
<input type="password" id="password" name="password" /> <br>
<label>确认密码:</label>
<input type="password" id="confirm" /> <br>
<label>姓名:</label>
<input type="text" id="name" name="name" /> <br>
<label>性别:</label>
<select id="sex" name="sex" style="width: 100px;height: 30px;">
<option value="1">男</option>
<option value="2">女</option>
</select> <br>
<input id="photo" name="photo" type="file" style="float: right;margin-right: 60px;" value="添加照片"/>
<label>生日:</label>
<input type="text" id="birth" name="birth" onClick="WdatePicker()" clientidmode="Static" /> <br>
<label>联系方式:</label>
<input type="text" id="contact" name="contact" /><br>
<label>入职时间:</label>
<input type="text" id="entryTime" name="entryTime" onClick="WdatePicker()" clientidmode="Static" /> <br>
<label>微信:</label>
<input type="text" id="wechat" name="wechat" /> <br>
<label>公司名称:</label>
<select id="company" name="company" style="width: 100px;height: 30px;">
<option value="0">不限</option>
</select> <br>
<label>备注:</label>
<input type="text" id="content" name="content" /> <br>
<input type="submit" value="上传" />
</form>
后台接收
@POST
@Path("/addimage")
@Produces(MediaType.TEXT_PLAIN)
@Consumes("multipart/form-data")
public String addimage(FormDataMultiPart formDataMultiPart) throws UnsupportedEncodingException{
return null;
}
但是前端会报错
POST http://192.168.223.31:8080/intelligentStage-system-manage/rest/admin/addimage 415 (Unsupported Media Type)
请大神解释一下,谢谢