关于JSP乱码的问题,请大家留步,帮我看一下
JSP出现乱码,不知怎么解决。问题在代码里标出了
<%@ page contentType="text/html; charset=GBK" pageEncoding="GBK" language="java" import="java.util.Vector, function.*, book.*" errorPage="" %>
<jsp:useBean id="bc" class="book.BookCategory" scope="page" />
<jsp:useBean id="func" class="function.Functions" scope="page" />
<jsp:useBean id="b" class="book.Books" scope="page" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题文档</title>
<script type="text/JavaScript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>
</head>
<body background="../img/bkground.jpg">
<%
if (request.getParameter("isSuccess")!=null) {
out.println("<script language='javascript'>");
out.println("<!--");
out.println("alert('这本书已经存在于购物车,你可以通过会员购物车进行查看')");
out.println("-->");
out.println("</script>");
}
%>
<form action="Book-ShoppingCart.jsp" method="post">
<center>
<%
Vector vResult = func.DispCategory();
String str = "";
for (int i=0; i<vResult.size(); i++) {
bc = (BookCategory)vResult.get(i);
%>
<a href="Book-List.jsp?Category=<%= bc.getCategory() %>"> // 自跳转
<font face="华文新魏" size="+2" color="#4A3C8C"><%= bc.getCategory() %></font>
</a>
<%
}
%>
<br><br><br><br>
<%
String strCategory = "";
if (request.getParameter("Category") == null)
strCategory = "计算机";
else {
strCategory = new String(request.getParameter("Category").getBytes("GBK"), "GBK"); // 乱码问题无法解决
}
%>
<label style="font-family:'华文新魏'; font-size:x-large"><font color="#FF0000"><%= strCategory %></font></label>
<br><br><br><br>
</center>
<table width="100%" border="1" bordercolor="#3366CC" align="center">
<tr bgcolor="#003399">
<th valign="middle" align="center"><img src="../img/botton_basket.gif"/></th>
<th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">图书名称</font></th>
<%
if (!strCategory.equals("热销推荐") && !strCategory.equals("新书推荐")) {
%>
<th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">ISBN</font></th>
<%
}
%>
<th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">图书作者</font></th>
<th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">图书出版社</font></th>
<th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">原价</font></th>
<th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">会员价</font></th>
</tr>
<%
if (vResult.isEmpty()) {
vResult.clear();
} else {
vResult.removeAllElements();
}
bc.setCategory(strCategory);
vResult = func.BookList(bc);
for (int i=0; i<vResult.size();i++) {
b = (Books)vResult.get(i);
%>
<tr>
<td align="center" valign="middle"><a href=../jsp/AddShopping.jsp?bookid=<%= b.getBookID() %>&bookname=<%= b.getBookname() %>&bookquantity=1&bookprice=<%= b.getOrignlprice() * 0.8 %>&page=booklist&category=<%= strCategory %>><font face="幼园" color="#003399">放入购物车</font></a></td>
<td align="center" valign="middle"><a href="Book-Detail.jsp?BookName=<%= b.getBookname() %>">
<font face="幼园" color="#003399"><%= b.getBookname() %></font></a></td>
<td align="center" valign="middle"><font face="幼园" color="#003399"><%= b.getAuthor() %></font></td>
<td align="center" valign="middle"><font face="幼园" color="#003399"><%= b.getPublisher() %></font></td>
<td align="right" valign="middle"><font face="幼园" color="#003399"><%= b.getOrignlprice() %></font></td>
<td align="right" valign="middle"><font face="幼园" color="#003399"><%= b.getOrignlprice() * 0.8 %></font></td>
</tr>
<%
}
%>
</table>
<br><br>
<center><input type="submit" value="确认" style="font:'华文细黑'; font-size:medium" /></center>
<br /><br /><br />
</form>
</body>
</html>
希望大虾帮帮忙,谢谢了
------解决方案--------------------
<url-pattern >//* </url-pattern >
有错误
<url-pattern >/* </url-pattern >