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


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

    action之外使用标签

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

    • Tag

    • Tag

    • Tag

    • Tag

    Tag

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

    标记的规则定义中可以看到这方面的一个例子,其中 %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>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    Tag

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

    • name

    • description

    • final

    • initial

    • multidimensional

    • private

    • transient

    • type

    Tag

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

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

    <csr:description>
        The <b>SCRIPT LANGUAGE=SQLb> 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>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30

    Tag

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

    下面的例子取自标签:

    <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"
            >
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
  • 相关阅读:
    淘宝/天猫获取sku详细信息 API 返回值说明
    电大搜题:开启智慧学习新时代
    硬盘分哪几种类型及主要参数详解
    万字长文详述ClickHouse在京喜达实时数据的探索与实践
    YOLO7 口罩识别实战
    初识Python类和对象
    聚观早报 | 遥感AI大模型发布;拼多多启动11.11大促
    华清 Qt day4 9月20
    科层制是单向流动,违背DevOps三步法,是浪费和低效的根源
    Linux vim的常见基本操作
  • 原文地址:https://blog.csdn.net/yaoxin521123/article/details/127896731