File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes EL functions - returning a  int. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "EL functions - returning a  int. " Watch "EL functions - returning a  int. " New topic
Author

EL functions - returning a int.

Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
Hello Guys,
I am just trying to implement an EL example from HF book. I have looked at method signatures a million times and not sure where I am going wrong. Please could you help me?

tld file: diceroller.tld placed directly under WEB-INF


The class with the function: DiceRoller placed in the package foo.


The JSP page:


I get the following error:


Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61417
    
  67

The Spec isn't exactly clear on this point, but I read it to mean that primitive types can't be used. I'd change the function to return java.lang.Integer.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
I did change the static function to return at Integer Bear!
The error is same as the above!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61417
    
  67

Did you specify Integer or java.lang.Integer?

The error message isn't begin very helpful, is it?
[ September 01, 2007: Message edited by: Bear Bibeault ]
Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
Changed the method signature in the tld to java.lang.Integer
Still the error message is just the same as above.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61417
    
  67

Hmmm, I got nothing. Just for comparison, here's an EL function I've defiend that works fine. Perhaps you might try a similar function to see if it works for you?

Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
Did that! no luck!
Same error. The container is able to locate the tld but it is not able see the function. Do you think it has anything to do with the versions I use?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61417
    
  67

OK, so that does mena its environmental ratehr than your declaration. What versions of things are yo using?
Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
JSTL 1.1 (does that mean its the same version for EL?)
Tomcat 5.5(does that mean Servlet ver 2.4 and JSP 2.0 ?)
jre 1.4.2

Im able to run simple custom tags, EL expressions, JSTL tags like jsp:useBean etc.

Thanks for helping Bear!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61417
    
  67

Hmmm, should you not be using JDK 1.5 with Tomcat 5.5?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Bear Bibeault:
Hmmm, should you not be using JDK 1.5 with Tomcat 5.5?


Yes, you either need 1.5 or you need to install the 'compat' package that allows you to run with 1.4.
(I've always done the former so I don't know much about the latter).


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Muni K Reddy
Ranch Hand

Joined: Aug 23, 2007
Posts: 74
Yup, finally the code worked. Feels good with a brand new JDK.

Thank you Bear and Ben!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EL functions - returning a int.