Dashboard > WebWork > ... > Cookbook > Application, Session, Request objects in jsp
  WebWork Log In View a printable version of the current page.  
  Application, Session, Request objects in jsp
Added by Robert Douglass, last edited by Philip Luppens on Feb 22, 2007  (view change)
Labels: 
(None)

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

<ww:property value="#application.foo"/>

<ww:property value="#session.baz"/> // or <ww:property value="#session['baz']"/>

Conversely, if you would like to make webwork objects availible to say the jsp/jstl request scope. The property tag can be used like this.

You no longer have to use the set tag to use objects in JSTL - they are automatically provided in WW 2.2.x.
<ww:set name="jobz" value="jobs" scope="request" />

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

WW:Exposing webwork objects to JSTL, with a JSTL and DisplayTag Example

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

<ww:property value="#session.id" />
<ww:property value="#page.request.session.id" />
...?

Posted by rwdaigle at Mar 12, 2004 08:29 | Permalink

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[OS:'jobz']"/> can not work - ???

Posted by weily at Jun 09, 2004 02:40 | Permalink
Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.9 Build:#527 Sep 07, 2006) - Bug/feature request - Contact Administrators