Child pages
  • Application, Session, Request objects in jsp
Skip to end of metadata
Go to start of metadata

The application, session and request objects are available from within s tags in jsp wherever ognl can be evaluated. Use the #application, #session, or #request syntax to get the object and access values by their keys using ['key'].

Accessing scoped variables via <s:property.../> tags

Conversely, if you would like to make Struts 2 objects available to a JSP/JSTL scope, the s:set tag may be used like this:

Expose OGNL 'jobs' value to JSP/JSTL scope 'jobz'


In Struts 2 OGNL values are automagically exposed to JSP/JSTL; using <s:set.../> as described above may not be necessary.

A full example below shows a struts variable "jobs" being exposed as "jobz" and being used with jstl and the display tag.

Exposing framework objects to JSTL, with a JSTL and DisplayTag Example

  • No labels


  1. Unknown User (rwdaigle)

    How do you get the session id using this notation. I have tried all of the following, but to no avail:

    <ww:property value="" />
    <ww:property value="" />

  2. Unknown User (weily)

    perhaps beacuse you use the foregoing setter tag directly, beacuse the value fo 'jobz' is string , so the value should be quoted with '' i.e. <ww:set name="jobz" value="'jobs'" scope="session" /> or <ww:set name="jobz" value="123" scope="session" />
    then you can use <ww:property value="#session.jobz"/> get the vlaue

    BUT <ww:property value="#session'jobz'"/> can not work -(sad) ???