Chinaunix首页 | 论坛 | 博客
  • 博客访问: 660555
  • 博文数量: 220
  • 博客积分: 10487
  • 博客等级: 上将
  • 技术积分: 2072
  • 用 户 组: 普通用户
  • 注册时间: 2009-08-09 00:25
文章分类

全部博文(220)

文章存档

2012年(5)

2011年(38)

2010年(135)

2009年(42)

我的朋友

分类: Java

2009-11-10 01:14:46

示例较多

通过亲自实践,提醒注意以下几点:

1.需要在页面引入标签:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
      <sj:head jqueryui="true"/>
  </head>


该标签的作用是会导入jQuery必须的资源文件,如下所示(IE8开发人员工具截图)


2.如果需要使用效果,动画等特殊JQuery功能,标签需要设置jqueryui="true",相见tld说明


<tag>
    <description><![CDATA[Render a chunk of HEAD for your HTML file]]></description>
    <name>head</name>
    <tag-class>com.jgeppert.struts2.jquery.views.jsp.ui.HeadTag</tag-class>
    <body-content>empty</body-content>
    <attribute>
      <description><![CDATA[If set to false it will force the pages that you request to not be cached by the browser.]]></description>
      <name>ajaxcache</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[BETA!!! If set to true it will enable history and bookmarking for AJAX content and jQuery UI Tabs.]]></description>
      <name>ajaxhistory</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[use compressed version of jquery.js]]></description>
      <name>compressed</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[base path for custom jQuery designs]]></description>
      <name>customBasepath</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[jQuery UI theme]]></description>
      <name>jquerytheme</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[enable jQuery UI Scripts]]></description>
      <name>jqueryui</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[Load JavaScript from google content distribution network]]></description>
      <name>loadFromGoogle</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <attribute>
      <description><![CDATA[import jQuery i18n scripts]]></description>
      <name>locale</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
    <dynamic-attributes>false</dynamic-attributes>
  </tag>


总的来说jQuery框架语法简介,功能强大。是非常优秀的JS库,基于它开发的UI组件数不胜数。个人觉得Struts 2 JQuery插件,主要是大约十几个标签,对于Ajax,网页动态效果较为突出,可在项目中酌情利用。不足之处是:文档缺乏,基本上无官方文档。
阅读(1956) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~