bali208 bali208 - 1 year ago 113
Java Question

What are <required> and <rtexprvalue> used for?

I was working on custom tag libraries and I was confused how the

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?

Answer Source

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="${}"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download