Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to create struts2 ognl example in java?


Asked by Robin Merritt on Dec 12, 2021 Java



We will first look into the OGNL usage with basic data types such as String, boolean, int, arrays and lists. Then we will create our own converter class for a custom java bean variable. Our final project structure for Struts2 OGNL example looks like below image.
And,
In struts 2 OGNL is used to associate Action class and UI components. OGNL uses a standard naming convention to evaluate the Expression. OGNL is the root object for the value stack. In Struts 2 value stack is a set of several objects but OGNL looks value stack as a single object.
Furthermore, Struts tutorial article is aimed to provide basic details of Struts 2 and how we can create our first “Hello World” Struts 2 application. Apache Struts 2 is an open source, industry standard, flexible and extendable framework to build Java EE web application. Struts 2 is based on OpenSymphony WebWork framework.
Moreover,
Struts 2 is based on OpenSymphony WebWork framework. Struts 2 is very flexible in terms of development and configurations and we will see how easy it is to develop a web application using Struts 2 framework. Below diagram shows different component of Struts 2 in a web application.
In addition,
Object-Graph Navigation Language (OGNL) is a powerful Expression Language that is used to manipulate data stored on the ValueStack. As you can see in architecture diagram, both interceptors and result pages can access data stored on ValueStack using OGNL. Struts 2 Action components handle the client requests.