我使用Java 6,JBoss 7.1.3和Spring 3.2.11.RELEASE。尽管我们设置这个在我们的应用程序上下文如何在不触及每个JSP文件的情况下为我的所有JSP设置pageEncoding?
<bean id="systemPrereqs"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" value="#{@systemProperties}" />
<property name="targetMethod" value="putAll" />
<property name="arguments">
<!-- The new Properties -->
<util:properties>
<prop key="org.apache.catalina.connector.URI_ENCODING">UTF-8</prop>
</util:properties>
</property>
</bean>
我在我的JSP注意到,特殊字符不正确,除非我们在JSP页面的顶部指定
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
呈现。这对于一个JSP来说很好,但是添加这些指令需要通过整个应用程序是很麻烦的。是否还有更多的全局地方可以指定它,比如在Spring上下文中或者其他地方,它会将上面的指令普遍地添加到我们所有的JSP页面中?
给了我一个去,但它没有奏效。 – Dave