• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fully qualified name in EL functions

 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In tld for EL function i have specified
<function-signature>String getMsg()</function-signature>
and it works.
According me String should be java.lang.String i.e fully qualified name
How it works?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java language specification
7.5.5 Automatic Imports
Each compilation unit automatically imports all of the public type names declared in the predefined package java.lang, as if the declaration:
import java.lang.*;

So you don't need to specify the fully qualified name for classes in the java.lang package.
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But we specify <function-signature>String getMsg()</function-signature>
in tld file not in class file.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but the container will read the TLD, and try to resolve the class String, maybe calling Class.forName. It will find it because java.lang is automatically imported.
 
Sayak Banerjee
Ranch Hand
Posts: 292
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP spec on page 3-24 (on TLds) says(referring to return type in function-signature) :

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, Second Edition,
Chapter 18.

Example:
java.lang.String nickName( java.lang.String, int )


Now, Satou, whatever you said makes sense...but it does not explain me this....the same should apply for <exception-type> sub-element in <error-page> element in the DD...but if you put somethin' like Throwable instead of java.lang.Throwable it won't work.....Is it because it is in the DD and the one that Gowher mentioned earlier is a TLD element?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic