Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using EL within a servlet

 
Pete Nelson
Ranch Hand
Posts: 147
Debian Eclipse IDE Tomcat Server
  • 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!
 
David Newton
Author
Rancher
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
Debian Eclipse IDE Tomcat Server
  • 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.
 
That feels good. Thanks. Here's a tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!