• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

EL functions - returning a int.  RSS feed

 
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!
 
Marshal
Posts: 67254
170
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
Marshal
Posts: 67254
170
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
Marshal
Posts: 67254
170
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
Marshal
Posts: 67254
170
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
Marshal
Posts: 67254
170
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?
 
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!
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!