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
0
votes
0 answers

OGNL exception breaking the normal flow when AOP is in place

I am working on Struts2 and spring integrated project. I am getting OGNL exception as: - Error setting expression 'lookupLicProductSKU.udiPID' with value '[Ljava.lang.String;@1feae0f' ognl.OgnlException: target is null for setProperty(null,…
kumarji.alluri
  • 197
  • 1
  • 3
  • 13
0
votes
4 answers
0
votes
2 answers

Multiple field ognl type converter

I have a form with (at the moment) two fields and submit the following: capture.id = 213 capture.description = DescriptionText The target object 'capture' is immutable and I would like to provide a type converter to take both values and call the…
Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
0
votes
1 answer

how to write loop in Ognl?

I'd like to reimplement the following Java code with Ognl: while((s=bufferedReader.readLine()) != null) System.out.println(s); but I have no idea, could you give me point? Thanks in advance!
rmn190
  • 611
  • 1
  • 9
  • 19
0
votes
1 answer

Populate user defined objects from a list from the JSP

In my Action class, I have a List of Questions. that I would want to be populated from the view. public class MyQuizTest extends ActionSupport { public String addItemsToTemplate(){ List q= myQuestions; …
user962206
  • 15,637
  • 61
  • 177
  • 270
0
votes
2 answers

How do I set a float without using an OGNL converter?

I have a class that looks like this: public class Foobar { private float value; public void setValue(float value) { this.value = value; } } I then have a webpage (Struts2) that passed in a variable foobar.value.
Trevor Allred
  • 888
  • 2
  • 13
  • 22
0
votes
0 answers

Warnings when evaluate a variable in Struts2 tag

I've a problem when I've to show a bean property in a struts tag. I've log4j to debug mode, and when I use OGNL expression to evaluate a bean, I get the correct value in the screen, but I also get a lot of warnings in console. Here's the…
Gore
  • 199
  • 1
  • 2
  • 12
0
votes
1 answer

displaytag in Struts2 is unable to find the properties with capitalized first letter

When I'm displaying the properties with name user_id its perfectly showing. But If I want to display the values like "User_id " its prompting to cant find the property (NOMETHODFOUND EXCEPTION) and also Inappropriate OGNL expression: (d - 49216) - s
Das
  • 87
  • 1
  • 10
0
votes
2 answers

How to calculate values dynamically from textbox using jQuery?

I have an invoice.jsp page where I have to calculate some value in the textbox using jQuery or with any other way. I don't know much about jQuery. Please help me to solve this problem. In my invoice there is a quantity textbox. If the user enters…
Dan
  • 2,086
  • 11
  • 71
  • 137
0
votes
1 answer

struts2, Invoke session variable method with static parameter

I don't know if my Permission Checking is right but I'm doing it this way. public class User { public boolean hasPermission (String permission){ // codes here to check from Roles.permissions if permission parameter exists // return…
Macchiato
  • 825
  • 1
  • 11
  • 24
0
votes
1 answer

How to display session value in JSP which is declared in interceptor?

I am new and testing struts2. Got value in session declared in the interceptor. Want to display session value in JSP but unable to do it. Anyone tell me how to do it in OGNL? Interceptor package com.myapp.interceptors; import…
Pirzada
  • 4,685
  • 18
  • 60
  • 113
0
votes
1 answer

Struts 2 Validation Adding Field Error to List

My form has a parameter consisting of a grid/table (presented via s:iterator) of data together with other fields represented in my action class as: public class MyAction extends ActionSupport { private MyParameter param; public String execute()…
nmenego
  • 846
  • 3
  • 17
  • 36
0
votes
2 answers

How to use struts tag iterator and OGNL to realize multiple rows selection

I would like to do multiple rows selection. Rows are display through strut2 tag s:iterator, how can I get the selection information, which should contains a list of selected "id"
Jenny
  • 107
  • 2
  • 11
0
votes
1 answer

How to use OGNL expression in JSP / Struts2

Like EL, is it possible to use any OGNL expressions outside of the s: tags in regular HTML? e.g., if I wanted to get the value of some bean in EL I would do something like
${beanName.propertyName} within DIV blocks or something. How can this…
user1111871
  • 137
  • 1
  • 12