wood burning stoves 2.0*
The moose likes JSP and the fly likes Is it possible to use a tag w/in a tag with tag files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Is it possible to use a tag w/in a tag with tag files?" Watch "Is it possible to use a tag w/in a tag with tag files?" New topic
Author

Is it possible to use a tag w/in a tag with tag files?

Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
I want to do something like this:

<tag:head><tag:js src="foo.js"/></tag:head>

However, when I use body-content="scriptless" in head.tag, it blows up. When I use body-content="tagdependent", "<tag:js src="foo.js"/>" is spit out w/o being evaluated.

Thanks,


Matt<br /> <br />Author: <a href="http://springlive.com" target="_blank" rel="nofollow">Spring Live</a> and <a href="http://www.apress.com/book/bookDisplay.html?bID=256" target="_blank" rel="nofollow">Pro JSP</a><br />Weblogs: <a href="http://raibledesigns.com" target="_blank" rel="nofollow">Raible Designs</a> <a href="http://jroller.com/page/raible" target="_blank" rel="nofollow">Spring Live Blog</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

it blows up


Some details on the explosion might be helpful.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
Nevermind, I got it working - don't know what was causing the non-evaluation before.

I do have a new problem though - if I turn on trimSpaces in Tomcat's web.xml - all the lines spit out by my tag files are on the same line. With a regular JSP, line breaks are honored. Any ideas?

Thanks,

Matt
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

No, but why does it matter?
Matt Raible
author
Ranch Hand

Joined: Jan 11, 2001
Posts: 114
Originally posted by Bear Bibeault:
No, but why does it matter?


It doesn't matter for an aesthetics point of view, but web developers might get annoyed the output doesn't look like their input. It works fine on JSPs, just not on Tag files. I'm using Tomcat 5.0.25.

Matt
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60780
    
  65

Originally posted by Matt Raible:
but web developers might get annoyed the output doesn't look like their input


As the Dread Pirate Roberts once said "Get used to disappointment."

Seriously, worrying about what the output of a JSP looks like is really not a very valid concern.
[ August 23, 2007: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it possible to use a tag w/in a tag with tag files?
 
Similar Threads
calling .js in jsp
I can't see the error in this page
question about custom tag
Is body-content="JSP" useless now ?
JavaScript function in HTML body