Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

renderRequest in expression language

Cn we be able to use Expression language for renderRequest.getPreferences().getValue(). Currently, I am using scriplet in the jsp page and I want to avoid scriptlets.

like image 681
user525146 Avatar asked Jan 27 '26 19:01

user525146


1 Answers

If you're using EL 2.2 or higher, expressions of this form should work:

${request.getPreferences().getValue('foo', 'some default')}

Generally, this is only available on Java EE 6 platforms.

On earlier versions you should be able to use an expression like this:

${request.preferences.map['foo']}

Note that this will return an array. If you want a single value, you may need to employ a layer of indirection.

Caveat: none of this code has been tested.

like image 100
McDowell Avatar answered Jan 30 '26 09:01

McDowell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!