File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Syntax of tld function-signature with varargs

 
Max Rahder
Ranch Hand
Posts: 177
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to specify a function in a tld for a method whose argument is a varchar. What's the syntax?

My signature is,
public static String removeEnds(String string, String... prefixes) {

I'm not really sure what to try in the tld, although the obvious does not work:
<function-signature>java.lang.String removeEnds(java.lang.String, java.lang.String...)</function-signature>

When I tried this I got the following runtime error, so it obviously isn't recognizing that "String..." is special sytax, and not the name of a class.
org.apache.jasper.JasperException: The class java.lang.String... specified in the method signature in TLD for the function fn:removeEnds cannot be found. java.lang.String...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never tried to do this, but as varargs syntax is just syntactic sugar for arrays, you might try using array notation instead. Please let us know what you discover.

P.S. Please use code tags, rather than bold, to post code fragments. Thanks.
 
Max Rahder
Ranch Hand
Posts: 177
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the idea, but that didn't work either. I can't figure it out. I switched the method to take a string and a delimiter -- the routine splits the string and processes the resulting array as before.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't mean to change the method... just how it was specified in the TLD.
 
Max Rahder
Ranch Hand
Posts: 177
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I tried that first -- changed the signature in the tld to array. Then I tried passing in fn:split() on the items, etc. I tried several combinations, and finally waved the white flag and went with the solution above. Thanks for the help. :-)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic