- This topic has 3 replies, 2 voices, and was last updated 14 years, 11 months ago by
support-shalini.
-
AuthorPosts
-
Kevin HunterMemberUpgraded from 8.0 to 8.5. In the new version, every time we use one of our custom JSP tags, we get an “invalid attribute” warning on every attribute of the tag. (Yellow underline, “Invalid attribute ([attribute name here])” Type=JSP Problem.
The individual tags define the specific attributes, so it isn’t a question of really using an undefined attribute. For example, the following tag file:
<%@ attribute name="album" required="true" type="(our internal class name goes here)" %><%@ taglib prefix="s" uri="/struts-tags" %><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ tag dynamic-attributes="dynAttr" body-content="empty" %>(body of tag continues here)
will generate a warning every time it is referenced thus in a JSP file:
<tt:albumTitle album="${albumInfo}" />
The yellow underline is on the contents of the quotes
If I do this
<tt:albumTitle album="xyz" />
the warning goes away.
While I realize that the JSP validator may not be able to validate that the first example is of the correct type, it’s kind of odd that it then turns around and accepts the second example, where the value is, in fact, NOT of the correct type.
support-shaliniMemberkdhunter,
Can you set “rtexprvalue” to true in your tld file and check if the issue persists?<attribute> <name>name</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute>
Kevin HunterMemberWe’re not using tld files in this project – we’re using .tag files, and then using the following:
<%@ taglib tagdir="/WEB-INF/tags" prefix="tt" %>
to define the tags to the JSP file.
Per http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags6.html “Tag files placed in a subdirectory of /WEB-INF/tags/ do not require a TLD file and don’t have to be packaged”
That being said, I tried adding a TLD file referencing the tag file, and this didn’t do any good.
Note that the “attribute” XML tag that you refer to above is not supported for the “tag-file” element within a TLD file, only for the “tag” element (which, as I’m sure you know, is for declaring custom tags implemented in Java, as opposed to tag files.)
“rtexprvalue” *can* be provided as an argument to the “attribute” tag in the tag file itself. When I do that (with the value “true”), the problem goes away. But this suggests that you have a bug, because according to http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags5.html#wp89854, rtexprvalue is supposed to default to “true” for tag files.
But, at least I have a workaround for the moment.
support-shaliniMemberkdhunter,
I could replicate this at my end. I have filed a PR with the dev team.
Thank you for bringing this up. -
AuthorPosts