JSP tag file that either outputs its body or returns it in a variable

前端 未结 3 1373
一生所求
一生所求 2021-02-20 00:59

I have a custom tag in a \".tag\" file that computes and outputs a value. Because I cannot post the code here, let\'s assume a simple example.

Content of file mytag.tag:

3条回答
  •  被撕碎了的回忆
    2021-02-20 01:41

    Based on another answer, a variable alias seems to be a great workaround. Here is a simple example:

    <%@ attribute name="urlValue" required="true" type="java.lang.String" %>
    <%@ attribute name="var" required="true" type="java.lang.String" rtexprvalue="false" %>
    <%@ variable alias="varAlias" name-from-attribute="var" scope="AT_BEGIN" variable-class="java.lang.String"%>
    
    
    
    

提交回复
热议问题