最近在写一个用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"> </span></td> <td class="line_table" align="center"><span class="left_bt2"> </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}页 共${page.totalPage}页 </span> <span class="left_bt2"> <c:choose> <c:when test="${page.currentPage == 1}"> [首页] </c:when> <c:otherwise> <a href="${pageContext.request.contextPath}/MenusServlet?method=findByPage¤tPage=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¤tPage=${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¤tPage=${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¤tPage=${page.currentPage+1}">[下一页]</a> </c:otherwise> </c:choose> </span> </td> </tr> </table> </div> </td> </tr> </table> </body> </html>
可以试试bootstrap fileinput
说来说去 还是编码问题 !!!
可是图片的编码怎么处理呢