File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Can a custom tag return a jsp tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Can a custom tag return a jsp tag?" Watch "Can a custom tag return a jsp tag?" New topic

Can a custom tag return a jsp tag?

John Pritchard
Ranch Hand

Joined: Nov 15, 2002
Posts: 49
Hi all-
I am fumbling through the correct implementation of the Composite View pattern using custom tags to may runtime determinations of JSP content. I have a custom tag that evaluates the username/password of the user at login and performs a set of :

statements among others. The problem is that all of the html tags that appear in my out.println statements get evaluated fine by the JSP. None of the jsp:includes do however. The statements do end up in the source returned to the browser however. For example if I do a view source on the resulting webpage, I see all the <jsp:include> tags it's just they were not interpretted. I've been through the Professional JSP text but are unable to find a definitive answer if you can return jsp tags in a custom tag. I'm using Weblogic 7.0.

John Pritchard<br />If a JTree falls in the woods, is it Observable
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

No, the JSP tags are evaluated at translation time, and your custom tags execute at run time -- long after the JSP tags have been evaluated.
For your particular problem, remember that the value of the page attribute on the jsp include tag can be a run-time value, and you can perform an include operation from within the custom tag code.
[ January 09, 2003: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Can a custom tag return a jsp tag?
It's not a secret anymore!