custom EL function that takes no parameters - possible?
I created an EL function that takes no parameters:
<function>
<name>noArg</name>
<function-class>com.example.customtag.function.PrintHi</function-class>
<function-signature>java.lang.String noArg()</function-signature>
</function>
I invoke it as follows in a jsp:
<c:set var="myvar2" value="${ 开发者_如何学Cmytags:noArg() }"/>
<c:out value="${myvar2}"/>
This works and produces the desired output in my browser (just returns a string). But Eclipse is telling me the above <c:set...
is invalid. Specifically at mytags.noArg()
So I am wondering if this is the correct way to implement a noarg EL function.
Thanks.
Yes, this is absolutely the correct way to implement such a function.
If it works, then don't worry about it. Eclipse's JSP validation is far from perfect.
精彩评论