aspose file tools*
The moose likes Struts and the fly likes OGNL with Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "OGNL with Struts2" Watch "OGNL with Struts2" New topic
Author

OGNL with Struts2

Reghu Ram Thanumalayan
Ranch Hand

Joined: Oct 21, 2003
Posts: 193
Hello Brown,
I have been using standard JSTL EL in my projects and since Struts 2 uses OGNL which apparently is a more powerful and flexible language than JSTL EL, would you suggest moving away from EL and start using OGNL ? How much of an effort would it be to migrate from EL to OGNL expression syntax? Does the book cover this aspect?

Regards,
Reghu


Cheers,<br />Reghu Ram T<br /> <br />SCJP 1.4 - 98 %, SCBCD 1.3 - 94 %, SCMAD 1.0 - 92 %
Santoshkumar Jeevan Pawar
Greenhorn

Joined: Aug 19, 2006
Posts: 27
can you please elaborate what it is "OGNL", i am listening first time this.
Reghu Ram Thanumalayan
Ranch Hand

Joined: Oct 21, 2003
Posts: 193
OGNL is the Object Graph Notation Language which according to the Struts 1 vs Struts 2 comparison page, is a more powerful and flexible expression language than JSTL EL.
chad michael davis
Author
Greenhorn

Joined: Mar 01, 2006
Posts: 27
OGNL is the expression language and "glue technology" used in Struts 2. Mostly you can think of it as the EL that you use from your tags to reference data properties on objects in the Struts 2 framework. It is true that OGNL is very powerful, but its role as a EL is little different than what you are already familiar with. It would be quite easy to use if you have used JSTL.

I personally think you shoudl avoid the power tools of OGNL as they usually mean that you are bringing too much logic into your view pages, but that's up to you


Chad Davis<br />Co-author of Struts 2 in Action
Don Brown
author
Greenhorn

Joined: Apr 22, 2008
Posts: 25
Also, I'd like to point out it isn't an either/or decision with OGNL and JSP EL. For example, the Struts 2 tags don't allow JSP EL within their attributes, for security reasons, so you are only allowed to use OGNL expressions there. As Chad pointed out, OGNL is very powerful, but unfortunately, at least in my opinion, JSP EL is the opposite - not powerful enough. One of the features under discussion in the Struts dev list is how to resolve this by perhaps extending the JSP EL, then using it over OGNL, but again, that is only in the very early discussion phase and may or may not ever happen.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Reghu Ram T",
Please check your private messages regarding an important administrative matter.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OGNL with Struts2