Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL functions - returning a int.

 
Muni K Reddy
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Muni K Reddy
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did change the static function to return at Integer Bear!
The error is same as the above!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so that does mena its environmental ratehr than your declaration. What versions of things are yo using?
 
Muni K Reddy
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, should you not be using JDK 1.5 with Tomcat 5.5?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Muni K Reddy
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, finally the code worked. Feels good with a brand new JDK.

Thank you Bear and Ben!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic