两个JSP页面进行GET传值的时候。两个页面的编码都是UTF-8,且传值之前设置response的content为UTF-8也解决不了问题。

设置tomcat的配置文件server.xml;在Connector节点下添加URIEncoding="UTF-8";

<!-- 之前 -->
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<!-- 之后 -->
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />

完整的server.xml如下:

<?xml version='1.0' encoding='utf-8'?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to
You under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<!-- Note: A "Server" is not itself a "Container", so you may not define
subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html -->
<Server port="8005" shutdown="SHUTDOWN">
<!-- Security listener. Documentation at /docs/config/listeners.html <Listener
className="org.apache.catalina.security.SecurityListener" /> -->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- Prevent memory leaks due to use of particular java/javax APIs -->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html -->
<GlobalNamingResources>
<!-- Editable user database that can also be used by UserDatabaseRealm
to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources> <!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container", so you
may not define subcomponents such as "Valves" at this level. Documentation
at /docs/config/service.html -->
<Service name="Catalina"> <!--The connectors can use a shared executor, you can define one or more
named thread pools -->
<!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150"
minSpareThreads="4"/> --> <!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at : Java HTTP Connector: /docs/config/http.html
(blocking & non-blocking) Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP)
Connector: /docs/apr.html Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<!-- <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" /> --> <Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />
<!-- A "Connector" using the shared thread pool -->
<!-- <Connector executor="tomcatThreadPool" port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" redirectPort="8443" /> -->
<!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the
BIO implementation that requires the JSSE style configuration. When using
the APR/native implementation, the OpenSSL style configuration is required
as described in the APR/native documentation -->
<!-- <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false"
sslProtocol="TLS" /> --> <!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> <!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone analyzes
the HTTP headers included with the request, and passes them on to the appropriate
Host (virtual host). Documentation at /docs/config/engine.html --> <!-- You should set jvmRoute to support load-balancing via AJP ie : <Engine
name="Catalina" defaultHost="localhost" jvmRoute="jvm1"> -->
<Engine name="Catalina" defaultHost="localhost"> <!--For clustering, please take a look at documentation at: /docs/cluster-howto.html
(simple how to) /docs/config/cluster.html (reference documentation) -->
<!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> --> <!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI resources
under the key "UserDatabase". Any edits that are performed against this UserDatabase
are immediately available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
</Realm> <Host name="localhost" appBase="webapps" unpackWARs="true"
autoDeploy="true"> <!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn"
/> --> <!-- Access log processes all example. Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" /> </Host>
</Engine>
</Service>
</Server>

JSP页面GET传值乱码问题的更多相关文章

  1. 转:jsp页面显示中文乱码解决方案

    jsp页面显示中文乱码: jsp页面的编码方式有两个地方需要设置: <%@ page language="java" import="java.util.*&quo ...

  2. JSP页面的中文乱码

    jsp页面显示中文乱码:    jsp页面的编码方式有两个地方需要设置:   <%@ page language="java" import="java.util. ...

  3. java 读取数据库中文信息,为何在jsp页面中出现乱码

    有如下几种解决办法:1.保证项目的字符编码和每一个jsp页面的字符编码一致,如果不一致可能导致中文乱码问题<%@ page language="java" contentTy ...

  4. 关于JSP页面URL传值所遇到的小问题

    在JSP页面中我的页面传值加了分号,在后台取值是没有问题的. 但是在XML底层执行时就会返回不了值,这是什么原因呢? 经过努力排查发现了分号导致了${XXX}的值都成了和前面ID一样的串.去掉${XX ...

  5. include 指令和 include 动作引入 jsp 页面时中文乱码

    include指令:<%@ include file="new.jsp" %> include动作:<jsp:include page="new.jsp ...

  6. JSP页面传递参数乱码问题整理

    1.JSP页面之间传递中文参数乱码 (1).a.jsp中正常传递参数,b.jsp 中 <% String projectName = new String(request.getParamete ...

  7. jsp页面显示数据库乱码

    如何页面是utf-8,数据库也是的话,页面显示数据库乱码的话,就是数据库的格式有问题

  8. 如何在两个jsp页面之间传值,在另外一个页面用EL表达式获取值

    第一个jsp页面 <% String ids=request.getParameter("id"); int id=Integer.parseInt(ids); %> ...

  9. jsp页面的传值(list)

    jsp页面与xml文件对应的关系: 例:网页上jsp的url为----purchase_app_btn.do? 对应xml文件下的 <action path="/purchase_ap ...

随机推荐

  1. .net EventHandler 事件处理

    通常定义事件 都是通过自定义委托的方式来实现, 今天使用EventHandler   委托来定义事件: public class NewMailEventArgs : EventArgs { priv ...

  2. Android-广播发送与接收(Java代码中订阅)

    Android四大组件之一广播,使用的也比较多,广播可大致分为两种,一种是Android系统区域的广播,是由系统指令发出,例如:点亮屏幕广播,开机过程中的一些广播 省略…, 然而还有一种广播就是我们自 ...

  3. mysql按照天或小时group分组统计

    select DATE_FORMAT( deteline, "%Y-%m-%d %H" ) , COUNT( * ) FROM test GROUP BY DATE_FORMAT( ...

  4. [Erlang14]怎样模拟节点互连后的各种失败情况?

    情景: 当节点群互连时,会通过心跳包检查所连接节点是不是连接正常,这个心跳时间默认为60s,可以通过 net_kernel:set_net_ticktime(600). 来重设这个时间值,怎么测试? ...

  5. [SIP00]SIP 概念总结

    SIP ---------------------------   Session Initiation Protocol ---------------------------   create, ...

  6. python的requests库详解

    快速上手 迫不及待了吗?本页内容为如何入门 Requests 提供了很好的指引.其假设你已经安装了 Requests.如果还没有,去安装一节看看吧. 首先,确认一下: Requests 已安装 Req ...

  7. docker+selenium Grid搭建自动化分布式测试环境

    自动化测试需要考虑到兼容性的时候,之前的做法是每个执行机上安装不同版本的浏览器,实际上这样做会很浪费硬件资源,现在有了docker容器化技术,让一切变得简单. 工具清单: 语言:python 2.7 ...

  8. c# 与 Mysql 的通讯方式总结

    两种开发方式 1.使用 vs 自带的可视化工具,不推荐. 在 vs 的项目中添加 ‘数据集’,然后通过可视化的工具添加数据库为数据源,默认可添加 SQL Server 和 Oracle 等,添加 My ...

  9. .net core i上 K8S(六).netcore程序的service网络代理模式

    上一章我们讲了pod的hostip模式,但在生产环境中,我们都是通过service来访问k8s集群的,service有两种模式来暴漏端口,今天我们来分享一下 1.clusterIP模式 我们在创建se ...

  10. 【QTP专题】02_时间同步点问题

    一.什么是同步点 同步点是指在一个测试过程中,指示QuickTest等待应用程序中某个特定过程运行完成以后再运行下一步操作.Waits until the specified object prope ...