views:

25

answers:

2

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

A: 

Including tag declarations inside of other custom tags--I do this all the time and with syntax matching yours.

Erik Hermansen
Does it work with tags that are all right under /WEB-INF/tags in your application?Thanks for your reply!
Ytsejammer
A: 

This is absolutely legal, and is part of the attraction of tag files.

If JDeveloper doesn't like it, that's JDeveloper's problem. You should consider using a modern IDE (eclipse, netbeans, intellij) instead, JDeveloper's time (if it ever had one) is long gone.

skaffman
Thanks for the reply,This is exactly what I wanted to hear. I tried the arrangement in multiple containers (Jetty, Tomcat, OC4J itself) and works like a charm. I was suspicious it was JDeveloper. Piece of junk.I HATE JDeveloper. I managed to stay away from it for over a year for my current project (we used Maven + the developer's favorite IDE). Now that we are delivering the project; my client (who currently uses JDeveloper and is not willing to change it within the organization) wants the project to be configured in this cr*ppy tool because that's "what they use to build their EAR files".
Ytsejammer