File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts and EL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts and EL?" Watch "Struts and EL?" New topic
Author

Struts and EL?

Todd Farmer
Ranch Hand

Joined: May 28, 2004
Posts: 59
I posted this in the SCWCD forum first, but received no responses, so I thought this may be a more appropriate forum.

I'm finding as I try to implement the Struts example that is at the end of HF, my EL tags are not being evaluated in my JSPs. There is nothing in my web.xml or anywhere else that I can find that is directly responsible for this, and other (non-Struts) applications running on the same server (Tomcat 5) evaluate the EL expressions when I use the same JSP. I even tried going straight to the JSP (taking it out of WEB-INF) in the Struts app, and the EL still does not evaluate.

EL really gets promoted in HF, so I'm wondering why it would be disabled in Struts (if it is). Is there something I'm not doing right to enable EL? I know EL is enabled by default, but does that change when using Struts? I've searched through two Struts books and online, and I haven't found any answers. I see that there are subprojects of Struts that have "-el" attached to them (e.g., struts-el.jar), but I can't really find useful documentation on whether this would help me enable EL with Struts or not, or how to use it.

Any information or pointers would be greatly appreciated.

Todd Farmer
Suzanne Israel
Greenhorn

Joined: Aug 23, 2002
Posts: 11
Originally posted by Todd Farmer:
I see that there are subprojects of Struts that have "-el" attached to them (e.g., struts-el.jar), but I can't really find useful documentation on whether this would help me enable EL with Struts or not, or how to use it.


Todd - you're on the right track.

you will need to put the following in your WEB-INF/lib folder or server classpath in addition to struts.jar etc:

struts-el.jar
jstl.jar

Your JSP page should include EL-specific taglib directives, e.g:
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>

That should give you what you need.

Specific information regarding Struts EL implementation is at:
http://struts.apache.org/faqs/struts-el.html

There's also some helpful content regarding the non-EL vs EL Struts taglibs in Struts: The Complete Reference (James Holmes & Herb Schildt)

I hope this helps.

regards,
Suzanne Israel
[ October 31, 2004: Message edited by: Suzanne Israel ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts and EL?
 
Similar Threads
expression language
Doubt on EL and Custom Tags
EL and Struts?
Doubt related to EL
defining beans in struts-el