李树桓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
    关注
    评论

报告相同问题?

悬赏问题

  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划