Search code examples
javajspelportletwebsphere-portal

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.


Solution

  • 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.