李树桓88 2016-04-15 09:35 采纳率: 0%
浏览 1456

jersey框架下上传form表单出错

前端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)
请大神解释一下,谢谢
  • 写回答

1条回答 默认 最新

  • devmiao 2016-04-15 15:45
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB yalmip 可转移负荷的简单建模出错,如何解决?
  • ¥15 数学的三元一次方程求解
  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?