Can I use a *.tag from another *.tag file in the same /WEB-INF/tags folder?
        Posted  
        
            by Ytsejammer
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ytsejammer
        
        
        
        Published on 2010-04-03T00:03:18Z
        Indexed on 
            2010/04/03
            0:13 UTC
        
        
        Read the original article
        Hit count: 410
        
Hello,
I am trying to refactor my JSP code so that a small conditional test condition gets reused through a *.tag file.
There are some big parts of my UI that depend on the value of a two-state property of an object present in the request. Let's say the property is 'gender' and the object is of type Person.
Like I said, I would like to simplify & centralize the test on the gender property using a tag. For this purpose, I created two tag files:
/WEB-INF/tags/if-male.tag
/WEB-INF/tags/if-female.tag
Now, I have another tiny spot that gets repeated in all over my application; let's say is the salutation to my site user. With this idea, I created a tag like this:
/WEB-INF/tags/salutation.tag
As you can imagine, I am trying to use the if-male/if-female test within the salutation.tag file to output 'Mrs.' or 'Mr.' like this:
<%@ tag body-content="empty" %>
<%@ taglib prefix="g" uri="/WEB-INF/tags" %>
<g:if-male> Mr. </g:if-male>
<g:if-female> Mrs. </g:if-female>
Is the use of the if-male/if-female tags legal within the salutation.tag file?
I have tried with such arrangement, but it looks like the JDeveloper 10.1.3.4 compiler gets confused and cannot deal with the salutation.tag tag invoking the other two tags in the same 'library' (folder under /WEB-INF/tags).
The reference works perfectly in Jetty 6 and it looks like it works as well if I deploy the application to OC4J directly without relying on JDeveloper to pre-compile all my JSPs.
I hope someone can shed some light on this.
Thanks,
YJ
© Stack Overflow or respective owner