| Author |
Passing array in an EL taglib function
|
Allan Cheong
Ranch Hand
Joined: Nov 12, 2009
Posts: 68
|
|
Hi all,
I am playing with some codes and found that I am unable to create such function:
.tld
MyFunction.java
.jsp
The problem occurs at .jsp I believe. However if I change the .jsp to the following, it works.
Any ideas on how I can pass array (String ...) in a taglib function in JSP?
|
SCJP6, SCJD, SCWCD5
Perspective
Freaky Codes
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
As far as I remember this is not supported yet...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Allan Cheong
Ranch Hand
Joined: Nov 12, 2009
Posts: 68
|
|
|
Noted with thanks.
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1043
|
|
Any ideas on how I can pass array (String ...) in a taglib function in JSP?
If variable arguments where supported you would have to define the function in the TLD like this:
but that gives the following error:
The class java.lang.String... specified in the method signature in TLD for the function formTags:testFunction cannot be found.
It is expecting a fully qualified class name as parameter.
The proof can actually be found in the jsp2.0 specs:
JSP.C.1XML Schema for TLD, JSP 2.0
<xsd:element name="function-signature" type="j2ee:string">
<xsd:annotation>
<xsd:documentation>
Provides the signature, of the static Java method that is
to be used to implement the function. The syntax of the
function-signature element is as follows:
FunctionSignature ::= ReturnType S MethodName S? '(' S? Parameters? S? ')'
ReturnType ::= Type
MethodName ::= Identifier
Parameters ::= Parameter | ( Parameter S? ',' S? Parameters )
Parameter ::= Type
Where:
* Type is a basic type or a fully qualified Java class name (including package name), as per the 'Type' production in the Java Language Specification
Regards,
Frits
|
 |
 |
|
|
subject: Passing array in an EL taglib function
|
|
|