Questions tagged [ognl]

OGNL stands for Object-Graph Navigation Language. It is an expression language for getting and setting properties of Java objects.

OGNL stands for Object-Graph Navigation Language (pronounced oganal); it is an expression language for getting and setting properties of Java objects, plus other extras such as list projection and selection and lambda expressions. You use the same expression for both getting and setting the value of a property.

The official site, gives the following uses to which OGNL has been applied:

  1. A binding language between GUI elements (textfield, combobox, etc.) to model objects. Transformations are made easier by OGNL's TypeConverter mechanism to convert values from one type to another (String to numeric types, for example)
  2. A data source language to map between table columns and a Swing TableModel;
  3. A binding language between web components and the underlying model objects;
  4. A more expressive replacement for the property-getting language used by the Apache Commons BeanUtils package or JSTL's EL (which only allow simple property navigation and rudimentary indexed properties).

It is used as an expression language in various projects:

  1. Apache Click
  2. Spring Web Flow
  3. Tapestry
  4. Struts 2.

Useful resources:

  1. Official Site
  2. Developer Guide
  3. Language Guide
622 questions
5
votes
1 answer

Escape string using Struts2 tags

I am trying to escape characters How can I escape Achat d'eclair in Struts2 tags ?
John
  • 53
  • 3
5
votes
3 answers

How to use multiple forms / actions in a single view in Struts 2

I have a search box which is displayed on every page. The JSP code for the search box is inserted into every page via tiles. The search box has a form and an action class SearchAction which needs to preload some properties for drop down boxes. The…
nharrer
  • 618
  • 7
  • 21
5
votes
1 answer

Using a LabelValueBean properly

I have a variable: private ArrayList circleNameIdList; inside my Action class where it's value get populated. I want to display the label in my drop-down in JSP and when one label is selected, the corresponding value to that…
Siddharth Trikha
  • 2,648
  • 8
  • 57
  • 101
5
votes
3 answers

OGNL Array and List Indexing

I'm sending this parameter to my struts action cdata[1]=bar In my action I'm interested in the index and the value. I defined a getter/setter pair for CDATA as the OGNL documentation suggests: public void setCdata(int index, String value){ …
kosmičák
  • 1,043
  • 1
  • 17
  • 41
5
votes
2 answers

Struts 2 OGNL - Comparing two string values in validation.xml

I am new to Struts2 and OGNL and am making a simple web application with a registration page. There are two fields, password and repassword (to re-enter the password) and using the validation framework i would like to validate that the two passwords…
Ben Lamm
  • 603
  • 8
  • 18
5
votes
3 answers

Struts 2 s:select tag dynamic id

I have multiple fields of various types in a JSP page and one button. These fields are generated based on the info got from a metadata table that I have created. Since I don't know how many and what type of fields are present, I am giving dynamic…
android_eng
  • 1,370
  • 3
  • 17
  • 40
5
votes
2 answers

How to pass an object from a JSP form to an Action class in Struts2 without defining all form fields as a class property?

To make the question clear I make an example: consider theSubscriber form defined bellow in first.jsp:
Johnny
  • 1,509
  • 5
  • 25
  • 38
4
votes
1 answer

How to check if List contains the particular element or not in Struts2?

I have tried to check if the List contains particular element or not using Struts 2 in tag?
Jothi
  • 14,720
  • 22
  • 68
  • 93
4
votes
1 answer

Capitalizing an entire word in Struts2 / OGNL

I just can't see it. I want to do the equivalent of the following: listValue="%{capitalize(remoteUserName)}" inside an s:select tag. According to the struts documentation…
demongolem
  • 9,474
  • 36
  • 90
  • 105
4
votes
1 answer

How do I have dynamic parameter names in a Struts 2 action redirect?

So I'm trying to create an action redirect that has dynamic parameter names as well as values. I understand how to do this in the struts.xml file for parameter values, but cannot seem to get things to evaluate correctly for the parameter name. …
4
votes
3 answers

How to retrieve the elements of HashSet using Struts2 tag without using s:iterator

I am using Struts2. Please help me in understanding how to retrieve the elements of HashSet using Struts2 tag without using Struts iterator tag. struts.xml
Vasanth Subramanian
  • 1,040
  • 1
  • 13
  • 32
4
votes
1 answer

How to choose a value of a HashMap in select Struts2?

I ran into a problem with Struts2. I have a HashMap that I use in a form with a select to choose name and corresponding id to that name. HashMap iterates and populates my