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
2 answers

Can I keep a object reference in a hidden field in Struts 2?

Can I keep a object reference in a hidden field in Struts 2? My JSP: e.g.: employee is a reference which refer employee object in the action class which invokes above JSP file.
Sampath
  • 21
  • 3
0
votes
1 answer

Cannot load parameters in Struts 2 action

In reference to Struts 2 and business objects and the code stated there: I cannot load the rp.randomCode as it gives it null. I have getters/setters in both RequestParam class and the SendMessageOrStartChatAction. I can load (get the request param…
Mab
  • 181
  • 2
  • 3
  • 13
0
votes
1 answer

Ognl Exception Class cast exception

I have production sever have a deployment of struts 2 app. It will running fine and have no changes is sent to server but some time it will gives following exception and app has been crashed and after restart it will again running fine . I am using…
amamd
  • 1
  • 2
0
votes
2 answers

Evaluating Struts2 Function using IF TAG

I need to use Struts2 Tag to evaluate a function return value from different JSP pages. The function is implemented inside a Class, and I want to use it in different JSP pages Example: dosomething
bogha
  • 541
  • 2
  • 6
  • 15
0
votes
2 answers

Struts2 taglib, compare with null

I am trying to know why this code is not working when I compare a String with null in a JSP. myvar value is ${myvar} Above code works fine, and prints "myvar value is…
Guido
  • 46,642
  • 28
  • 120
  • 174
0
votes
1 answer

struts ognl dynamic expression

I've spent the last few hours to get a Struts expression to work as I want but didn' t succeeded. I want to execute a OGNL expression from a String. By example, I have the following code : alert('
0
votes
1 answer

OGNL selection with map

This simple program using OGNL returns me a list of null values instead of [A,B,D]. I've tried #root{#x.get(#this)} and still returns me a list of nulls. Why? Thanks. import java.util.ArrayList; import java.util.HashMap; import…
Apprentice Queue
  • 2,036
  • 13
  • 13
0
votes
1 answer

How to use getParameter() in Struts 2 tag?

I want to get a variable that I search in JSP, something like this " /> How to use getParameter() in Struts 2 tag?
boyka
  • 27
  • 1
  • 7
0
votes
4 answers

How to dynamically set the value to a static parameter in Struts 2

I was wondering, is it possible to dynamically set value to static parameter Dynamic value here
Storm Rider
  • 1
  • 1
  • 6
0
votes
1 answer

struts2 populate "value" object of map from Form post

I'm using struts 2. I have an object that contains some booleans. I have a HashMap that contains many of the previous objects defined by some key. In my jsp a table is populated with radio buttons. One line for each key of the map etc. When I post…
Panos
  • 7,227
  • 13
  • 60
  • 95
0
votes
2 answers

Is there a way to bind OGNL with Struts2 UI tags

I'm developing a webapp using Struts2. I used to work with Struts1 is there a way to reference a session object directly to the JSP so that if I change the value in the formular, the value in the referenced session object will also be…
raito
  • 1
  • 4
0
votes
1 answer

Problems on retrieving object on a JSP using ValueStack

I put an object in the Struts2's ValueStack inside the intercept method of my interceptor using this code: public String intercept(ActionInvocation invocation) ValueStack vS = invocation.getStack(); vS.set("mainViewComponent", new…
user2100029
0
votes
3 answers

Struts 2 conditional div tag

I am working on my website and trying to print out portfolio objects from the database. The page where I print them out to has pagination. I use a script to create a new page when the following tag is used:
...
A maximum…
user1191027
0
votes
1 answer

How do you compare 2 struts param in a struts if

I'm am still pretty new to struts and am having trouble trying to compare two struts params in a struts if statement. I am trying find if the current year param is equal to the checkYear param If they are equal I want to execute some code. If they…
0
votes
1 answer

OGNL Expression Parsing vs Compilation

In OGNL, it is recommended to parse expressions that are reused in order to improve performance. When consulting the API, I also noticed that there is a compileExpression method: After searching thoroughly for information on compilation vs parsing,…
jr.
  • 1,699
  • 14
  • 31