jsp中的include静态页面出现乱码问题
在当前应用系统的web.xml里加入jsp-config代码:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<jsp-config>
<jsp-property-group>
<description>
Special property group for JSP Configuration JSP example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.jsp</url-pattern>
<el-ignored>true</el-ignored>
<page-encoding>GB2312</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
<description>
Special property group for JSP Configuration JSP example.
</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>*.html</url-pattern>
<el-ignored>true</el-ignored>
<page-encoding>GB2312</page-encoding>
<scripting-invalid>false</scripting-invalid>
<include-prelude></include-prelude>
<include-coda></include-coda>
</jsp-property-group>
</jsp-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
... ...
</webapp>
说明:<jsp-config>里的定义,就是通知当前应用服务器,当前应用系统下,所有的 .jsp, .html 文件,若是没有定义contentType="text/html;charset=gb2312" 时,就会采用预设的 "GB2312" 字符集去处理,如此,就不须要在每个 include 的档案第一行加上 contentType="text/html;charset=gb2312" 了。
相关文档:
昨天在写东西的时候,数据库用的编码是UTF-8,页面也是UTF-8,然后存进数据库的时发现还是乱码。中文的时候,随后debug,查到Action里面得到的表单内容也是乱码,哈哈
问题找到了,原来是Form表单或者其他地方有问题
后来在web.xml中加上对Spring编码的控制语句,好了...呵呵
......
我刚学jsp,找了一个网站想配置好环境,然后改改,可是遇到一个问题,不懂怎么解决。请大家帮帮我!
问题如下:我装的环境是:eclipse+MyEclipse5.5+sql2000+tomcat5.5运行后出现:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this r ......
request, reponse, out, session, application, config, pagecontext, page, exception.
一.request对象:该对象封装了用户提交的信息,通过调用该对象相应的方法可以获取封装的信息,即使用该对象可以获取用户提交信息。
1.Request对象可以使用getParameter(string s)方法获取该表单通过text提交的信息。如:
Requ ......
1.request对象
客户端的请求信息被封装在request对象中,通过它才能了解到客户的需求,然后做出响应。它是HttpServletRequest类的实例。
序号 方 法 说 明
1 object getAttribute(String name) 返回指定属性的属性值
2 Enumeration getAttributeNames() 返回所有可用属性名的枚举
3 String getCharacterEncoding( ......
//下面,从请求中得到属性 为一个 类,,会判断是否为null,,如为null则实例化
// id 值 相当于 class 的 对象名
<jsp:useBean id="order" class="com.entity.Order" scope="request" />
<==>
<%
Order order=(Order)request.getAttribute("order");
if(order==null)
  ......