出现了一个无法解决的异常

出现了一个无法解决的异常

再我进行蛋糕进行编辑后,进行了提交。页面显示白板,没有任何内容,后台服务器打印了如下的报错信息:

先附上jsp页面内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 
<jsp:include page="top.jsp" />
 
<section id="content_wrapper">
    <section id="content" class="table-layout animated fadeIn">
        <div class="tray tray-center">
            <div class="content-header">
                <h2>编辑商品</h2>
            </div>
            <div class="admin-form theme-primary mw1000 center-block" style="padding-bottom: 175px;">
                <div class="panel heading-border">
                    <form method="post" action="/admin/Cake/edit.do" enctype="multipart/form-data" id="admin-form">
                        <input type="hidden" name="id" value="${cake.id}">
                        <div class="panel-body bg-light">
                            <div class="section row">
                                <div class="col-md-1" style="margin-top: 10px;"><b>名称</b></div>
                                <div class="col-md-5">
                                    <label for="title" class="field prepend-icon">
                                        <input type="text" name="title" id="title" value="${cake.title}" class="gui-input" placeholder="名称..." required>
                                        <label for="title" class="field-icon">
                                            <i class="fa fa-navicon"></i>
                                        </label>
                                    </label>
                                </div>
                                <div class="col-md-1" style="margin-top: 10px;"><b>状态</b></div>
                                <div class="col-md-3" style="margin-top: 10px;">
                                    <input type="radio" name="status" id="status1" class="radio" value="" <c:if test="${cake.status==''}">checked</c:if>> />
                                    <label for="status1">普通</label>
                                    <input type="radio" name="status" id="status2" class="radio" value="推荐" <c:if test="${cake.status=='推荐'}">checked</c:if> />
                                    <label for="status2">推荐</label>
                                    <input type="radio" name="status" id="status3" class="radio" value="特卖" <c:if test="${cake.status=='特卖'}">checked</c:if>  />
                                    <label for="status3">特卖</label>
                                </div>
                            </div>
                            <div class="section row">
                                <div class="col-md-1" style="margin-top: 10px;"><b>图片</b></div>
                                <div class="col-md-1" id="showImage"></div>
                                <div class="col-md-7">
                                    <input type="hidden" name="imagePath" value="${cake.imagePath}" />
                                    <input type="file" name="image" id="image" class="gui-file" placeholder="图片...">
                                </div>
                            </div>
                            <div class="section row">
                                <div class="col-md-1" style="margin-top: 10px;"><b>所属分类</b></div>
                                <div class="col-md-2">
                                    <label class="field select">
                                        <select id="language" name="cid">
                                            <c:forEach var="cat1" items="${root.children}">
                                                <c:forEach items="${cat1.children}" var="cat2">
                                                    <c:forEach items="${cat2.children}" var="cat3">
                                                        <c:if test="${cat3.id==cake.cid}">
                                                       <option value="${cat3.id}" selected>${cat1.title}->${cat2.title}->${cat3.title}</option>
                                                        </c:if>
                                                        <c:if test="${cat3.id!=cake.cid}">
                                                            <option value="${cat3.id}">${cat1.title}->${cat2.title}->${cat3.title}</option>
                                                        </c:if>
                                                    </c:forEach>
                                                </c:forEach>
                                            </c:forEach>
                                        </select>
                                        <i class="arrow double"></i>
                                    </label>
                                </div>
                                <div class="col-md-1" style="margin-top: 10px;"><b>口味</b></div>
                                <div class="col-md-2">
                                    <label for="taste" class="field prepend-icon">
                                        <input type="text" name="taste" id="taste" value="${cake.taste}" class="gui-input" placeholder="口味..." required>
                                        <label for="taste" class="field-icon">
                                            <i class="fa fa-coffee"></i>
                                        </label>
                                    </label>
                                </div>
                                <div class="col-md-1" style="margin-top: 10px;"><b>甜度</b></div>
                                <div class="col-md-2">
                                    <label for="sweetness" class="field prepend-icon">
                                        <input type="number" name="sweetness" id="sweetness"  class="gui-input" placeholder="甜度..." required min="1" max="5" value="value="${cake.sweetness}"">
                                        <label for="sweetness" class="field-icon">
                                            <i class="fa fa-star"></i>
                                        </label>
                                    </label>
                                </div>
                            </div>
                            <div class="section row">
                                <div class="col-md-1" style="margin-top: 10px;"><b>价格</b></div>
                                <div class="col-md-2">
                                    <label for="price" class="field prepend-icon">
                                        <input type="text" name="price" id="price" value="${cake.price}" class="gui-input" placeholder="价格..." required>
                                        <label for="price" class="field-icon">
                                            <i class="fa fa-cny"></i>
                                        </label>
                                    </label>
                                </div>
                                <div class="col-md-1" style="margin-top: 10px;"><b>重量</b></div>
                                <div class="col-md-2">
                                    <label for="weight" class="field prepend-icon">
                                        <input type="number" name="weight" id="weight" value="${cake.weight}" class="gui-input" placeholder="重量..." required>
                                        <label for="weight" class="field-icon">
                                            <i class="fa fa-database"></i>
                                        </label>
                                    </label>
                                </div>
                                <div class="col-md-1" style="margin-top: 10px;"><b>尺寸</b></div>
                                <div class="col-md-2">
                                    <label for="size" class="field prepend-icon">
                                        <input type="number" name="size" id="size" value="${cake.weight}" class="gui-input" placeholder="尺寸..." required>
                                        <label for="size" class="field-icon">
                                            <i class="fa fa-arrows"></i>
                                        </label>
                                    </label>
                                </div>
                            </div>
                            <div class="section row">
                                <div class="col-md-1" style="margin-top: 10px;"><b>材料</b></div>
                                <div class="col-md-8">
                                    <label for="material" class="field prepend-icon">
                                        <input type="text" name="material" id="material" value="${cake.material}" class="gui-input" placeholder="材料..." required>
                                        <label for="material" class="field-icon">
                                            <i class="fa fa-server"></i>
                                        </label>
                                    </label>
                                </div>
                            </div>
                        </div>
                        <div class="panel-footer text-right">
                            <button type="submit" class="button"> 保存 </button>
                            <button type="button" class="button" onclick="javascript:window.location.href='/admin/Cake/list.do';"> 返回 </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</section>
 
<jsp:include page="bottom.jsp" />

ide报错信息如下:

1
2
3
4
5
6
7
8
Caused by: org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
    at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:947)
    at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:310)
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:334)
    at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:115)
    at com.imooc.icake.controller.CakeController.builderCake(CakeController.java:92)
    at com.imooc.icake.controller.CakeController.edit(CakeController.java:68)
    ... 30 more


正在回答

登陆购买课程后可参与讨论,去登陆

3回答

同学你好,问一下同学在项目中是否加入了以下两个jar包?

http://img1.sycdn.imooc.com//climg/5d2bf2090001748202920050.jpg

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

  • litter_ 提问者 #1
    那个解决了,又出现了中文乱码问题,乱码的源头是jsp页面提交到servlet后,就已经出现了乱码,但是拦截器设置是正常的,也是utf-8的格式
    2019-07-15 13:37:32
  • litter_ 提问者 #2
    那个解决了,又出现了中文乱码问题,乱码的源头是jsp页面提交到servlet后,就已经出现了乱码,但是拦截器设置是正常的,也是utf-8的格式
    2019-07-15 13:37:32
吃吃吃鱼的猫 2019-07-15 14:58:54

同学你好,建议同学贴出拦截器的代码,方便老师为同学解决问题哦~

如果我的回答解决了你的疑惑,请采纳。祝:学习愉快~

提问者 litter_ 2019-07-14 20:07:50

1 requests

73 B transferred

0 B resources

Finish: 4 ms

DOMContentLoaded: 20 ms

Load: 20 ms

Headers

Preview

Response

Cookies

Timing

General

Response Headersview source

Content-Length:

0

Date:

Sun, 14 Jul 2019 12:04:49 GMT

Request Headersview source

Accept:

text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3

Accept-Encoding:

gzip, deflate, br

Accept-Language:

en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7

Cache-Control:

max-age=0

Connection:

keep-alive

Cookie:

Idea-406a5ebf=a6f5b324-79dd-4b9e-a6c7-6d847c49b04b; JSESSIONID=20FB8A0BBC6453B649A84B9548B9C7F5

Host:

localhost:8080

Upgrade-Insecure-Requests:

1

User-Agent:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

这是浏览器请求头的内容,就这些,没有其它的

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星

相似问题

登录后可查看更多问答,登录/注册

请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师
插入代码