什么是< required>和< rtexprvalue>用于? [英] What are <required> and <rtexprvalue> used for?

查看:154
本文介绍了什么是< required>和< rtexprvalue>用于?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究自定义标记库,我很困惑< required> < rtexprvalue> 标签在TLD文件中用于定义自定义标签属性。


  1. 这些标签是什么?

  2. 我们应该在它们之间写什么?

  3. 写完这些标签后会有什么行为?


解决方案

必需非常简单地暗示它所说的内容。该属性是必需的或必需的。



rtexprvalue 表示运行时表达式值。这意味着该属性可以支持scriptlet值。



elexprvalue 表示它可以支持EL(表达式语言)值。 / p>

因此,如果您将 requiredattr 定义为 required = true rtexprvalue = true elattribute 定义为 elexprvalue = true ,您可以写如下:

 < myprefix:mytag requiredattr =<%= baz.getId( )%>中elattribute = $ {foo.bar}/> 


I was working on custom tag libraries and I was confused how the <required> and <rtexprvalue> tags are used in the TLD file to define a custom tag attribute.

  1. What are these tags?
  2. What should we write in-between them?
  3. What behavior do we get after writing these tags?

解决方案

required quite simply implies what it says. The attribute is required or mandatory.

rtexprvalue means Runtime Expression Value. It means the attribute can support scriptlet values.

elexprvalue means it can support EL (expression language) values.

So, if you have requiredattr defined as both required=true and rtexprvalue=true and elattribute is defined as elexprvalue=true, you can write as follows:

<myprefix:mytag requiredattr="<%=baz.getId()%>" elattribute="${foo.bar}"/>

这篇关于什么是&lt; required&gt;和&lt; rtexprvalue&gt;用于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆