首页 新闻 会员 周边 捐助

JavaEE WEB项目向服务器上传PNG图片乱码

0
[待解决问题]

最近在写一个用mvc的web项目,在想服务器上传.png格式的图片时将图片做成超链接显示图片,结果是乱码,错误状态的照片不知道咋插入啊啊啊啊啊啊,需要URL?可是我是本地照片啊啊啊啊,纠结,就是点开超链接以后就是一页乱码,求大牛指点

加粗的地方就是图片超链接

<%@page import="java.util.*"%>
<%@ page language="java"  pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<base href="${pageContext.request.contextPath}/admin/" />
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #EEF2FB;
}
-->
</style>
</head>
<body>
    <table width="100%" height="1" border="0" cellpadding="0"
        cellspacing="0">
        <tr>
            <td valign="top" bgcolor="#F7F8F9">
                <div align="center">
                    <table id="table2" class="line_table"
                        style="width: 100%; margin: 0; padding: 0" cellSpacing="0"
                        cellPadding="0">
                        <tbody style="margin: 0; padding: 0">
                            <tr>
                                <td class="line_table" align="center" colspan="11" height="20"><span
                                    class="left_bt2">菜单信息列表</span></td>
                            </tr>
                            <tr>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">菜单名称</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">展示图片</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">原料</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">类型</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">说明</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">市场价格</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">市场价销售数量</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">会员单价</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">会员价销售数量</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">&nbsp;</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_bt2">&nbsp;</span></td>
                            </tr>
                            
                            <c:forEach items="${page.list}" var="menus">
                            <tr>
                                <td class="line_table" align="center"><a
                                    href="menus_update.jsp?">${menus.name}</a></td>
                                <td class="line_table" align="center"><a
                                    href="${pageContext.request.contextPath}/${menus.imgpath}"><img src="${pageContext.request.contextPath}/${menus.imgpath}"
                                        width="30" heigth="30"></a></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.burden}</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.typename}</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.brief}</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.price}</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.sums}</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.price1}</span></td>
                                <td class="line_table" align="center"><span
                                    class="left_txt">${menus.sums1}</span></td>
                                <td class="line_table" align="center"><a
                                    href="menus_update.jsp">修改</a></td>
                                <td class="line_table" align="center"><a
                                    href="${pageContext.request.contextPath}/MenusServlet?method=delById&id=${menus.id}" target="main">删除</a></td>
                            </tr>
                            </c:forEach>
                            <tr>
                                <td class="line_table" align="center" colspan="11" height="20">
                                <span class="left_bt2">第${page.currentPage}页
                                        &nbsp;&nbsp;共${page.totalPage}页
                                </span>&nbsp;&nbsp; 
                                <span class="left_bt2">
                                <c:choose>
                                    <c:when test="${page.currentPage == 1}">
                                        [首页]
                                    </c:when>
                                    <c:otherwise>
                                        <a href="${pageContext.request.contextPath}/MenusServlet?method=findByPage&currentPage=1">[首页]</a>
                                    </c:otherwise>
                                </c:choose>
                                </span>
                                <span class="left_bt2">
                                <c:choose>
                                    <c:when test="${page.currentPage == page.totalPage}">
                                        [尾页]
                                    </c:when>
                                    <c:otherwise>
                                        <a href="${pageContext.request.contextPath}/MenusServlet?method=findByPage&currentPage=${page.totalPage}">[尾页]</a>
                                    </c:otherwise>
                                </c:choose>
                                </span>
                                <span class="left_bt2">
                                <c:choose>
                                    <c:when test="${page.hasPrePage eq false}">
                                        [上一页]
                                    </c:when>
                                    <c:otherwise>
                                        <a href="${pageContext.request.contextPath}/MenusServlet?method=findByPage&currentPage=${page.currentPage-1}">[上一页]</a>
                                    </c:otherwise>
                                </c:choose>
                                </span>
                                <span class="left_bt2">
                                <c:choose>
                                    <c:when test="${page.hasNextPage eq false}">
                                        [下一页]
                                    </c:when>
                                    <c:otherwise>
                                        <a href="${pageContext.request.contextPath}/MenusServlet?method=findByPage&currentPage=${page.currentPage+1}">[下一页]</a>
                                    </c:otherwise>
                                </c:choose>
                                </span>
                                </td>
                            </tr>
                    </table>
                </div>
            </td>
        </tr>
    </table>
</body>
</html>

想成为程序员的主页 想成为程序员 | 菜鸟二级 | 园豆:202
提问于:2017-09-12 18:31
< >
分享
所有回答(2)
1

可以试试bootstrap fileinput

ycyzharry | 园豆:25683 (高人七级) | 2017-09-14 08:44
0

说来说去 还是编码问题 !!!

吉吉的城 | 园豆:566 (小虾三级) | 2017-09-14 18:40

可是图片的编码怎么处理呢

支持(0) 反对(0) 想成为程序员 | 园豆:202 (菜鸟二级) | 2017-09-14 18:42
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册