Question

I am developing a custom-tag handler in jsp which accepts one attribute named "yourname". The .tld file and tag handler files contain the same attribute name(I've checked the case as well). But somehow while I run the web-app, i get an exception. The exception message says "Attribute yourname invalid for tag sayhello according to TLD".

This is the tag information in tld file.

<tag>
<name>sayhello</name>
<tag-class>check.PrintTagHandler</tag-class>
<body-content>scriptless</body-content>
<attribute>yourname</attribute>
</tag>

This is the property name in the bean.

private String yourname;

This is the call

<hello:sayhello yourname="ABC"/>

Tag Declaration:

<%@taglib prefix="hello" uri="/WEB-INF/tlds/newtag_library2"%>

Everything seems to be correct but I am getting the exception.

Plese help.

Was it helpful?

Solution

Sorry everyone..

The tld should have been like this.

<attribute>
<name>yourname</name>    
<required>true</required>
<rtexprvalue>false</rtexprvalue>    
</attribute>

instead of

<attribute>yourname</attribute>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top