MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 关于JSP乱码的有关问题,请大家留步,帮我看一下

关于JSP乱码的有关问题,请大家留步,帮我看一下

www.MyException.Cn  网友分享于:2013-12-27  浏览:5次
关于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_basket.gif"/></th>
  <th valign="middle" align="center"><font face="幼圆" size="3" color="#ccffff">图书名称</font></th>

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有