| Author |
Tag question
|
zamies banno
Greenhorn
Joined: Jun 17, 2004
Posts: 3
|
|
Hi you all, I encountered an example of a custom tag and deployment of that tag which raised a question. The example is as follows: A custom tag implementing the Tag interface. public class ifTag implements Tag { private boolean condition; public void setCondition(boolean condition) { this.condition = condition; } public int doStartTag() throws JspException { if (condition) ....something else ...something else } ...all other methods .... } Now if I deploy this custom tag in a TLD as follows: <tag> ...name ... etc <attribute> ..... <rtexprvalue>true</rtexprvalue> </attribute> </tag> Isn't this wrong? Shouldn't you get an compile time error because of mismatching types? No type means default java.lang.String type? I mean aren't you supposed to declare the type of the attribute as being boolean? And what if you declare the following in the TLD: <attribute> ... <rtexprvalue>true</rtexprvalue> <type>boolean</type> </attribute> Does that means you can't use a request parameter as the trexprvalue for this custom tag directly, because you'll have to convert it from String to boolean first? well any help appreciated (on this subject that is). grtsBanno
|
 |
Jeroen Wenting
Ranch Hand
Joined: Oct 12, 2000
Posts: 5093
|
|
|
no specific type means the type is determined at runtime.
|
42
|
 |
zamies banno
Greenhorn
Joined: Jun 17, 2004
Posts: 3
|
|
This would mean that the servlet container takes care of it? Like with the implicit conversion in setProperty() with JavaBeans?
|
 |
 |
|
|
subject: Tag question
|
|
|