`

关于struts-jquery-plugin中Remote Link AnchorTag 的使用

 
阅读更多



 (一)anchortag.jsp代码的编写:

<?xml version="1.0" encoding="utf-8"?>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>AnchorTag 的使用</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="styles/layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/showcase.js"></script>
   <sj:head
   		locale="zh_CN"
    	loadAtOnce="true"
    	compressed="false"
    	jquerytheme="showcase"
    	customBasepath="themes"
    	loadFromGoogle="false"
    	debug="true"
    />
  
</head>
	<body>
		<div id="result">
			Div 1
		</div>
		<s:url
			id="ajax"
			value="ajax1" />
		<sj:a
			id="ajaxlink"
			href="%{ajax}"
			targets="result"
			indicator="indicator"
			button="true">
	  	请求
	</sj:a>
	</body>
</html>

 (二)action的编写:

package com.anchorajax;

import com.opensymphony.xwork2.ActionSupport;

public class AjaxAnchor extends ActionSupport
{
    public String execute() throws Exception {
        return SUCCESS;
    }
}

 (三)struts.xml的编写:

<!-- anhorTag的使用 -->
   		<action name="ajax1" class="com.anchorajax.AjaxAnchor">
   			<result name="success">/ajax1.jsp</result>
   		</action>

 (四)ajax1.jsp里的内容:

 

Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut
neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc.
Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur
malesuada. Vestibulum a velit eu ante scelerisque vulputate.

 (五)效果:



 (六)为了有请求等待的小图标:可以加上

<sj:a
			id="ajaxlink"
			href="%{ajax}"
			targets="result,div2"
			indicator="indicator"
			button="true"
			effect="shake"
			>
			<span class="ui-icon ui-icon-refresh"></span>
			<img id="indicator" src="images/indicator.gif" style="display:none"/>
	  	请求
	</sj:a>
 
  • 大小: 5.6 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics