第四十九章 开发自定义标签 - 在action之外使用<csr>标签

简介: 第四十九章 开发自定义标签 - 在action之外使用<csr>标签

第四十九章 开发自定义标签 - 在action之外使用标签

action之外使用<csr>标签

有一些标签可以在规则定义中的操作之外使用。 介绍以下标签:

  • <csr:class> Tag
  • <csr:property> Tag
  • <csr:description> Tag
  • <csr:attribute> Tag

<csr:class> Tag

<csr:class>标记允许使用IMPORTSUPERINCLUDES属性,使生成的规则类能够访问其他类方法。

<csp:else>标记的规则定义中可以看到这方面的一个例子,其中 %CSP.RuleBlock被指定为超类(默认情况下,%CSP.RuleElement是表示CSR页面DOM(文档对象模型)模型中的元素的所有类的超类。

<csr:rule name="%ELSE" match="CSP:IF/CSP:ELSE" empty>
<csr:class super=%CSP.RuleBlock>
<csr:action>
<SCRIPT LANGUAGE=Cache RUNAT=COMPILER>
    New ifblock
    Set ifblock=..GetCurrentBlock()
    If ifblock'="" {
        If ifblock.EndLabel="" Set ifblock.EndLabel=..GetNewLabel()
        Do ..WriteServer(" Goto "_ifblock.EndLabel_" ;}")
        Do ..WriteServer(ifblock.NextLabel_" ;{")
        Set ifblock.NextLabel=""
    }
</SCRIPT>
</csr:action>
</csr:rule>
复制代码

<csr:property> Tag

<csr:property>标记在规则类中定义了一个属性。 这允许为生成的csr类指定一个属性。<csr:property>的一个用途是在呈现开始标记期间设置一个属性,然后在呈现结束标记期间检查该属性。name属性指定属性的名称。 该属性支持以下属性:

  • name
  • description
  • final
  • initial
  • multidimensional
  • private
  • transient
  • type

<csr:description> Tag

<csr:description>标记包含自定义规则的描述和(可选的)示例。

下面是来自%SQLCURSOR规则的标记示例:

<csr:description>
    The <b>SCRIPT LANGUAGE=SQL</b> creates embedded SQL for a
    DECLARE CURSOR statement in the class generated by the CSP page.  The
    declared cursor will be opened using an SQL OPEN statement and the
    SQLCODE will be returned.  It is the programmers responsibility to
    display any error indicated by the SQLCODE value.<p>
    The mode of the query is determined by the MODE attribute.  The mode is
    taken to be a runtime mode by default.  If the COMPILERMODE attribute
    is specified, then the mode is taken to be a compile time mode that
    is defined by a generated #SQLCOMPILE statement.
    <p>For example:
    <EXAMPLE>
    <SCRIPT LANGUAGE=SQL CURSOR=prsn>
      select name,ssn from sample.person where ssn %STARTSWITH '2' order by ssn
    </script>
    <CSP:WHILE CURSOR=prsn INTO='Name,ssn' counter=x condition=(x<3)>
      Name: #(Name)#<br>
      SSN: #(ssn)#<br>
    </CSP:WHILE>
    </EXAMPLE>
    <p>Will display all people whose ssn begins with 1:
    <OUTPUT>
    Name: Smith, Joe<br>
     SSN: 111-11-1111<br>
    Name: Jones, Harry<br>
     SSN: 111-11-1122<br>
    and so on..<br>
    and so on..<br>
    </OUTPUT>
</csr:description>
复制代码

<csr:attribute> Tag

<csr:attribute>标记用于包含自定义标记的属性列表,以及每个属性的简要描述。

下面的例子取自<csp:content>标签:

<csr:attribute
        name=Type
        description="Specify the default Content-Type"
        type="contentType:STRING"
        >
<csr:attribute
        name=Charset
        description="Specifies the default charset"
        type="charSet:STRING"
        >
<csr:attribute
        name=NoCharSetConvert
        description="Turns off the charset conversion"
        type="noCharSetConvert:STRING"
        >


相关文章
|
2月前
uni-app 172标签列表和标签用户列表
uni-app 172标签列表和标签用户列表
26 1
|
29天前
element-ui中Form表单使用自定义验证规则
element-ui中Form表单使用自定义验证规则
10 0
|
JavaScript 前端开发 Go
第四十八章 开发自定义标签 - 在action中使用csr标签
第四十八章 开发自定义标签 - 在action中使用csr标签
|
JavaScript 编译器 Go
第五十一章 开发自定义标签 - 使用%CSP.Rule方法
第五十一章 开发自定义标签 - 使用%CSP.Rule方法
|
JavaScript 前端开发 Go
第三十四章 使用 CSP 进行基于标签的开发 - Hyperevent例子
第三十四章 使用 CSP 进行基于标签的开发 - Hyperevent例子
|
编译器 Go
第四十六章 开发自定义标签 - 标签匹配 操作中的运行时表达式
第四十六章 开发自定义标签 - 标签匹配 操作中的运行时表达式
|
XML 编译器 Go
第四十五章 开发自定义标签 - 规则和操作
第四十五章 开发自定义标签 - 规则和操作
14. 表单标签及其应用实例
14. 表单标签及其应用实例
65 0
14. 表单标签及其应用实例
|
Java 开发者
自定义标签之标签体内容类型|学习笔记
快速学习自定义标签之标签体内容类型。
188 0
|
Java 开发者
自定义标签之SkipPageException —不再执行标签下面的内容 | 学习笔记
快速学习自定义标签之SkipPageException—不再执行标签下面的内容
自定义标签之SkipPageException —不再执行标签下面的内容 | 学习笔记

相关实验场景

更多