Win a copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java this week in the Agile and Other Processes forum!
  • 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Using EL within a servlet

 
Ranch Hand
Posts: 147
Eclipse IDE Tomcat Server Debian
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that needs to send an e-mail message. The application was originally running on Tomcat 5.5, using Servlet 2.4/JSP 2.0/EL 1.0, all provided by the Tomcat container. I wrote the e-mail message to leverage EL, and then had my databean simply implement VariableResolver (resolved member variables) and FunctionMapper (always returns null - not used), and then resolved my e-mail message with this line:



That worked very well until we moved to Tomcat 6.0 (Servlet 2.5/JSP 2.1/EL 1.2). EL was completely changed, and the above no longer works. I found a very simple solution, adding Apache Commons EL 1.0 library to the web app, everything is fine.

However, I really want to know how the new EL is supposed to work, and have yet to find any decent examples from the java code side (lots of stuff from the JSP / JSTL side!). Does anyone know of any good examples of implementing the new ELResolver class in EL 1.2? It seems like a lot more complexity than in 1.0, and I could really use some examples ;)

Thanks to anyone with suggestions!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Not directly related, but ugh, I'd just use FreeMarker or similar templating language.)
 
Pete Nelson
Ranch Hand
Posts: 147
Eclipse IDE Tomcat Server Debian
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@David -

Not a bad suggestion! I will take a look at FreeMarker. I am still curious about EL, but if FreeMarker provides a simple solution, I'd probably run with it.
 
If you believe you can tell me what to think, I believe I can tell you where to go. Go read this tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!