Blog Stats
Posts - 0
Articles - 23
Comments - 2
Trackbacks - 0
文章档案
2008年10月 (5)
2008年9月 (4)
2008年8月 (7)
hanbing
Struts2+Jquery中的Json问题
json被定义undefined的问题:
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"
http://struts.apache.org/dtds/struts-2.0.dtd
">
<struts>
<constant name="struts.i18n.encoding" value="UTF-8"/>
<package name="example" extends="json-default">
<action name="JSONExample" class="lee.JSONExample">
<result type="json"/>
</action>
</package>
</struts>
在上面配置文件中有两个值得注意的地方:
第一个地方是配置struts.i18n.encoding常量时,不再是使用GBK编码,而是
UTF-8
编码,这是因为Ajax的POST请求都是以UTF-8的方式进行编码的。
第二个地方是配置包时,自己的包继承了json-default包,而不再继承默认的default包,这是因为只有在该包下才有json类型的Result。
posted on 2008-10-21 12:41
睡得惊动了党
阅读(200)
评论(0)
编辑
收藏
新用户注册
刷新评论列表
只有注册用户
登录
后才能发表评论。
网站导航:
博客园
IT新闻
Chat2DB
C++博客
博问
管理
Powered by:
.Text
and
ASP.NET
- Copyright © 睡得惊动了党