Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!

Matt Raible

author
Ranch Hand
+ Follow
since Jan 11, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Matt Raible

Sorry for the noise, it turns out it was caused by the fact that Tomcat (5.0.25) did not have a mapping for .jspf.

Matt
10 years ago
JSP
It seems that neither <jsp:include> nor <c:import> (or Struts 2's <s:import>) work in tag files. I'm fine with using "include file", but how do I specify a dynamic value for the file attribute?

The following doesn't work:

10 years ago
JSP
If I use the following in a JSP Tag File, only the 2nd one is processed:



Using <jsp:include> doesn't seem to work in tag files. Is that as designed?

Thanks,

Matt
10 years ago
JSP
If I use <%@ attribute name="class" required="false" %> in a JSP Tag file, it results in a blank page and the following error in my Tomcat console:



Any idea why? Change the attribute to "cssClass" works, but "class" is much more intuitive for web developers using my tag.

As a workaround, I can use dynamic-attributes. I'm just curious if this issue is documented anywhere or I'm just doing something wrong.

Thanks,

Matt
[ August 24, 2007: Message edited by: Bear Bibeault ]
10 years ago
JSP

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
10 years ago
JSP
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
10 years ago
JSP
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,
10 years ago
JSP
Adding type="java.util.Map" worked. Thanks! Unfortunately, I don't see a "caused by" in my stack trace.

I do see a NoClassDefFoundError though:

10 years ago
JSP

Originally posted by Stefan Evans:
Ok.
You can't nest custom tags in this manner.
You can't use a custom tag as an attribute to another custom tag.

Dynamic attributes are meant so that the tag will handle whatever parameters you pass it at runtime. However you can't dynamically create the attributes to the tag and then evaluate the tag in this manner.

An alternative would be to define another attribute to the <li:a> tag which takes a Map of name/value pairs.

ie like this



That's what I figured when I first started trying to solve this. However, your suggestion doesn't seem to work. In my "a.tag" file, I have:



And this results in:

10 years ago
JSP
Here's my JSP that's calling my tag file:



In anogb.tag, I have:



How do I pass {dynattrs} to my a.tag file in order to render the "style" attribute?

In a.tag, I have:



If I call <li:a> directly from my JSP, it works fine and renders the style attribute. However, if I try to pass the attributes to <li:a> with the following code, it bombs:



Error reported:



Thanks,
10 years ago
JSP
I'm using JSP 2.0 Tag files in a Struts 2 application. If I do something like the following, it works great:



In anogb.tag, I have:



However, if I change anogb.tag to reference another tag file, I'm unable to pass the dynamic-attributes to it. I've tried just about everything but haven't found a solution yet. Any ideas?

Thanks,

Matt
10 years ago
JSP
Did you add visitID to your model? Regardless, you should be able to access it using JSTL:

Spring Live has JSF coverage. ;-)
You could try JavaBB.