• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OGNL with Struts2

 
Reghu Ram Thanumalayan
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Santoshkumar Jeevan Pawar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please elaborate what it is "OGNL", i am listening first time this.
 
Reghu Ram Thanumalayan
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don Brown
author
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Reghu Ram T",
Please check your private messages regarding an important administrative matter.
-Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic