s:doubleselect 与 sx:div 结合使用,某些属性不设置会出现一些莫名的问题。sx:div这个Ajax标签的属性太多,不好好研究下它的属性而使用它会出现许多莫名的问题,其中列表选项无法联动就是比较难缠的问题。后来通过搜索发现此标签的“separateScripts”属性是其引起问题的主因!官方文档上说明了会影响Ajax标签的几个属性,如下:
Attribute
Default Value
Description
parseContent |
true |
When true, Dojo will parse the response into an XHTML Document Object and traverse the nodes searching for Dojo Widget markup. The parse and traversal is performed prior to inserting the nodes into the DOM. This attribute must be enabled to nest Dojo widgets (dojo tags) within responses. There's significant processing involved to create and parse the document so switch this feature off when not required. Note also that the response must be valid XHTML for cross-browser support and widgets must have unique IDs. |
separateScripts |
true |
When true, Dojo will extract the <script> tags from the response, concatenate the extracted code into one block, create a new Function whose body is the extracted code and immediately invoke the function. The invocation is performed after the DOM has been updated with the XHTML. The function is executed within the scope of the widget (that is, the this variable points to the widget instance). When false, Dojo will extract the <script> tags from the response, concatenate the extracted code into one block and: *in IE: invoke window.execScript() on the code *in other browsers: create a <script> node containing the code and insert that node into the DOM This invocation occurs after the DOM has been updated with the XHTML. Note that scripts may not be executed if it is not valid to create a <script> node in the DOM at the destination. |
executeScripts |
false |
When true, Dojo will extract code from the <script> tags from the response and execute it based on the separateScripts value. When false, the XHTML response is inserted into the DOM and <script> nodes are ignored. |
我们主要看 separateScripts ,其描述文字的主要大意是,如果此属性设置为“true”,Dojo会将从response中提取<script> 标签内的代码并组合到一个新建的函数,并立即调用。此属性默认就是“true”,这不是我们想要的,因此把此它设置为“false”,问题解决。
还需要注意的是executeScripts这个属性设置不好也会出现Javascript无法运行的问题,比如A.jsp文件内的标签sx:div异步引入B.html文件,此文件有一段Javascript代码,比如:<script>alert("弹出信息");<script>,若要此代码正常执行,则executeScripts属性必须设置为“true”。
分享到:
相关推荐
所有的s标签介绍-C: <s:checkbox></s:checkbox>-----复选框 ...<s:div></s:div>-----表示一个块,类似于html的<div></div> <s:doubleselect list="" doubleName="" doubleList=""></s:doubleselect>-----双下拉框
4. <s:div></s:div>-----表示一个块,类似于html的<div></div> 5. <s:doubleselect list="" doubleName="" doubleList=""></s:doubleselect>-----双下拉框 E: 1. <s:if test=""></s:if> 2. <s:elseif test=...
doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现doubleselect实现...
doubleselect. \
doubleselect.doc
struts2中doubleselect标签的具体应用实例,Hibernate、Struts2、Spring三框架整合
struts2 doubleselect标签的用法例子,功能是实现一个级联的下拉列表,一般书上的例子都用到了三目运算符,没有实际的使用价值。本例是一个完整的例子,已经调试运行正常。
struts2 doubleselect 实例
DoubleSelect11.vue
struts2 标签动态数据用法, 在实际应用中,list往往是action返回的一个List,listKey和listValue来显示第一级下拉框,doubleList往往是一个Map, List<DataObject>>,其中Map中的Key值是第一级下拉框的listKey。
用struts2 doubleselect标签实现的二级联动下拉菜单
J2EE中使用struts2实现的select和doubleselect标签
网络上找了很多Struts2级联doubleselect的实例,都没又找到可以直接的使用的源代码,给大家分享一下,可直接导入进行测试
Struts2的doubleselect标签演示,完整片断代码
两级级联下拉列表jquery插件doubleSelect.zip
不过,Struts 2.0加了几个我们经常在项目中用到的控件如:datepicker、doubleselect、timepicker、optiontransferselect等。因为这些标志很多都经常用到,而且参数也很多,要在一篇文章详细说明并非易事。 下面主要...
div标签:AJAX标签,生成一个div片段。 fielderror标签:输出异常提示信息。 tabbedPanel:AJAX标签,生成HTML中的Tab页。 tree标签:生成一个树形结构。 treenode标签:生成树形结构的节点。
从数据库中读取数据,hibernate,struts2,spring三框架整合
Struts2-Double-Select-Example