日期:2014-05-18  浏览次数:20756 次

关于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>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <%
  }
  %>
  <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_b