dojo 树对象

1.在项目中加入struts2-dojo-plugin-2.1.8.jar

2.在jsp页面中加入<%@ taglib prefix="sx" uri="/struts-dojo-tags"%> 

在<head><sx:head /></head>

<!-- 显示树列表 -->
  <sx:tree rootNode="root" nodeIdProperty="id" nodeTitleProperty="name" childCollectionProperty="childrens"
  showRootGrid="true"  showGrid="true"  id="nodeId">
  </sx:tree>

3.在web.xml中的strus2配置如下:

<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>/*</url-pattern>
 </filter-mapping>
 <filter-mapping>
若配置如下:

<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>*.jsp</url-pattern>
 </filter-mapping>
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>*.action</url-pattern>
 </filter-mapping>

 

则不能过滤js文件了,会报错,可以加

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

或者直接写成如下

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

 

 

你可能感兴趣的:(dojo 树对象)