当前位置: 代码迷 >> Java Web开发 >> struts1 myeclipse tomcat 从页面失去乱码
  详细解决方案

struts1 myeclipse tomcat 从页面失去乱码

热度:6738   发布时间:2013-02-25 21:14:46.0
struts1 myeclipse tomcat 从页面得到乱码
我在页面的下拉列表中显示数据库(sqlserver)的中文数据,能正常显示。但选中下拉列表的值,通过action的处理,再跳转到下一个页面显示这个中文时,是乱码。怎么办啊。。。

第一个页面,能显示从数据库得到的值
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@ page import="java.sql.ResultSet"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%request.setCharacterEncoding("utf-8"); 
  response.setCharacterEncoding("utf-8");
 
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
   
  <title>My JSP 'ddWmz.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
<!--
.button1 {border:1px solid #999999;
font-size:12px;
font-family:Tahoma;
background-color:#ffffcc
}
.style1 {color: #006699;
font-weight: bold;
font-family: "黑体";
font-size: 12px;
}
.style10 {font-size: 12px; color: #006699; font-family: "黑体"; }
.style14 {font-size: 12px; color: #FFFFFF; font-family: "黑体"; font-weight: bold; }
.style15 {color: #006699; font-weight: bold;
font-size:16px;
font-family: "楷体";
}
.style20 {color: #000000; font-size: 12px; font-family: "黑体"; }
.style26 {color: #FF3300}
a:link {
color: #009977;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #003366;
}
a:hover {
text-decoration: underline;
color: #006699;
}
a:active {
text-decoration: none;
color: #006699;
}
-->
</style>

<script type="text/javascript">
function next()
{  
document.form1.action="Ccxs.do";
document.form1.submit();
}
function onchange2()
{
document.form1.action="xxxx.jsp";
document.form1.submit();
}
</script>

  </head>
  
  <body>
  <form name="form1" method="post" >
  <table width="760" border="0" align="center" cellspacing="0">
  <tr>
  <td colspan="3"><span class="style1">订票</span></td>
  </tr>
  <tr>
  <td colspan="3"><hr size="1" /></td>
  </tr>
   

  <tr>
  <td width="50">&nbsp;</td>
  <td align="center" valign="middle" class="style15">&nbsp;</td>
  <td width="50">&nbsp;</td>
  </tr>
   
   
   
   
  <tr>
  <td width="50">&nbsp;</td>
  <td width="660" align="center" valign="middle" class="style15">
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Sat Oct 21 14:56:20 CST 2017
  • 最近登录:Sat Oct 21 14:56:20 CST 2017
  • 最近登录:Sat Oct 21 14:56:20 CST 2017
  • 最近登录:Sat Oct 21 14:56:20 CST 2017
  • 最近登录:Sat Oct 21 14:56:20 CST 2017