| Author |
calling a bean function using jstl
|
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
Hi
i m calling a bean function and getting the error
The function ast must be used with a prefix when a default namespace is not specified
I m using using glassfish v2.1
I have the bean
The taglib
in jsp im having
the line ${u.ast()} gives the error message (thanks to Bear Bibeault)
else everything works fine such as
Any help
Thanks
Pradyut
|
Pradyut
http://pradyut.tk/
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
Pradyut Bhattacharya wrote: the line ${u.ast()} gives the problem
In the future, please be sure to include the error message -- not just say "gives a problem". (Please read this for more information.)
But in this case, I can tell you that the problem is that EL functions must be static. You can't call instance methods.
Why are you using getProperty in place of the EL?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
thanks for the fast reply
changed the code to
but still could not get solved. The same error message
thanks for quoting the getProperty but i was just showing they are working just fine...
regards
Pradyut
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
|
You need to use the TLD's namespace to invoke the function.
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
could not understand tld namespace or wheres it located...
new to tld and namespaces :-(
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
You created the namespace when you mapped the TLD:
So to call the function:
By the way, the URI you chose doesn't follow the usual convention. It should look like a URL (even though it's not a URL) using a domain that you own. That way, there's never any chance of it conflicting with some other library's URI.
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
Changed the uri to "http://pradyut.dyndns.org/newtag_library"
Thanks but still no change... the same error message
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
You'll need to show your new files.
Are you sure that you are using a colon and not a dot to separate the namespace from the function name?
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
wow.. i didnt know the use of colons like that...
well the new exception thrown is...
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
|
That's because it's not declared in your TLD. You must add a function element to define the function otherwise how is the JSP engine supposed to know anything about it?
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
but in my tld i have
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
sorry about that... now my tld is...
and in jsp i m calling
and still the error message
please rescue...
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56202
|
|
|
Looks pretty clear to me; the class cannot be found. Did you compile the bean and put the class file in the correct location?
|
 |
Pradyut Bhattacharya
Ranch Hand
Joined: Aug 12, 2004
Posts: 63
|
|
thanks Bear Bibeault
you rocked it!!!
the tld should be
|
 |
Varun Selvanathan
Greenhorn
Joined: Jun 17, 2012
Posts: 10
|
|
This is the late comment.
I also found this same problem.
I got the solution by defining the method as static.
|
 |
 |
|
|
subject: calling a bean function using jstl
|
|
|