源代码解析——初探 AjaxTags

2016-02-19 14:12 1 1 收藏

图老师小编精心整理的源代码解析——初探 AjaxTags希望大家喜欢,觉得好的亲们记得收藏起来哦!您的支持就是小编更新的动力~

【 tulaoshi.com - Web开发 】


  AjaxTags项目是在现有的Struts HTML标记库的基础上,添加对AJAX支持。 AjaxTags改写了Struts标签类org.apache.struts.taglib.html.FormTag和org.apache.struts.taglib.html.BaseHandlerTag,并使用Struts的plugin技术,使得Struts提供了对AJAX的支持。 以下是jsp中简单的示例:
  
  html:form action="example1" ajaxRef="example1">
  First Name: html:text property="firstName" size="25" value="Frank" />
  br>
  Last Name: html:text property="lastName" size="25" value="Zammetti" />
  br>
  html:button property="button" value="Click to do Ajax!" ajaxRef="button" />
  /html:form>
  Result:br>
  span id="example1_resultLayer"> /span>
  
  注意ajaxRef属性。 ajaxRef属性中内容是在ajax-config.xml中定义的,如本示例的配置部分如下:
  
  !DOCTYPE ajaxConfig PUBLIC "ajaxConfig" "ajaxConfig">
  ajaxConfig>
  !-- Define a custom request handler that generates XML for example 2 -->
  handler name="CustomXMLGenerator" type="request">
  
  function>customGenerateXML/function>
  location>customXMLGenerator.js/location>
  /handler>
  !-- Configuration for example 1 -->
  form ajaxRef="example1">
  element ajaxRef="button">
  event type="onclick">
  requestHandler type="std:QueryString">
  target>example1.do/target>
  parameter>firstName=firstName,lastName=lastName/parameter>
  /requestHandler>
  responseHandler type="std:InnerHTML">
  parameter>example1_resultLayer/parameter>
  /responseHandler>
  /event>
  /element>
  /form>/ajaxConfig>
  
  在配置文件中定义了该表单的属性,以及按钮触发的事件和回写结果的处理方法。采用很巧妙的封装方法实现了Struts的AJAX调用。当然Ajaxtags离实用阶段还有相对长的一段距离,但它提供了一种在现有的软件架构上高效率开发ajax应用程序的可行性方案。

来源:https://www.tulaoshi.com/n/20160219/1606411.html

延伸阅读
标签: PHP
  info.inc.php主要做些判断和信息处理 <?php function update($reginfo) {      switch ($reginfo[4])       {      case ($reginfo[4]==1):        $reginfo[4]="男";    &...
标签: Web开发
bugtraq id 1500 class Access Validation Error cve GENERIC-MAP-NOMATCH remote Yes local Yes published July 24, 2000 updated July 24, 2000 vulnerable IBM Websphere Application Server 3.0.21 - Sun Solaris 8.0 - Microsoft Windows NT 4.0 - Linux kernel 2.3.x - IBM AIX 4.3 ...
标签: PHP
  repal.php回复用的页面,因为回复可以不必要是用户,所以没加用户身份校验 <html <head <title回复论题:<? echo $zt;?</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" <STYLE type=text/css P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt...
标签: PHP
  <html <head <titleUntitled Document</title <meta http-equiv="Content-Type" content="text/html; charset=gb2312" <STYLE type=text/css P {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt} DIV {FONT-FAMILY: normal; FONT-SIZE: 9pt; LINE-HEIGHT: 14pt} </STYLE <...

经验教程

549

收藏

55
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部