dojo

[b]struts2.1.X结合使用dojo:[/b]
struts2.0及以前,其对dojo的ajax支持是放在struts2-core-2.0.X.jar包中的;
struts2.1后,默认的dojo ajax支持被从core包中抽出放入了struts2-dojo-plugin-2.1.8.jar中。网上2.0及之前版本与dojo的结合例子多的是,这里说下2.1.8.1配置dojo:
jar:[quote]struts2-core-2.1.8.1.jar
struts2-dojo-plugin-2.1.8.jar[/quote]
[b]Troubleshooting guide migrating from Struts 2.0.x to 2.1.x:
[url]https://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html[/url][/b][quote]Reference the new taglib in your JSP or FTL pages.
Before (2.0的用法)
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>

After (2.1及之后的用法)
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>



Update the head tag
Before:
<s:head theme="ajax"/>

After:
<sx:head parseContent="true"/>



The web.xml before (matching all requests):
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Change to use the new StrutsPrepareAndExecuteFilter and match just struts requests.

The web.xml after:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/struts/*</url-pattern>
</filter-mapping>

[/quote]
[b]万一遇到 [color=red]'dojo' is undefined[/color] 未定义 错误:[/b]
[url]http://www.coderanch.com/t/445316/Struts/struts-dojo-undefined[/url][quote]Well, that won't work well unless you've extracted the static files out of the Struts jar.

As the S2 documentation states, the expected filter mapping is "/*". This is because Struts contains static files (the Dojo libraries, in this case), and expects to see *every* request, so it can serve those files.

By mapping to something other than the recommended mapping you're bypassing the default S2 behavior, and must adjust your deployment accordingly.[/quote]


Struts 2与AJAX
[url]http://www.blogjava.net/max/archive/2007/06/12/123682.html[/url]

Dojo Require 相关问题(怎样加载自定义的dijit)
[url]http://hi.baidu.com/yz20090909/blog/item/3bae6629e22501f1e6cd4082.html[/url]

dojo.io.bind
Dojo入门教程之dojo.io.bind详解:
[b][url]http://www.zhuoda.org/weiking/94629.html[/url][/b]

error: function(type, error) { alert(error.message); }, //error is dojo.io.Error

dojo.io.bind 介绍:
[url]http://www.blogjava.net/zolly/archive/2006/10/25/Dojo_Introduction.html[/url]

dojo.require("dijit.layout.ContentPane");
[url]http://api.dojotoolkit.org/jsdoc/HEAD/dijit.layout.ContentPane.setContent[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值