3

I need to check if a session variable exists. I can check if it is present and set to a variable:

<when expression="#[sessionVars['foo'] == 'true']">

But I want something like:

<when expression="#[sessionVars['foo']]">
-- or --
<when expression="#[Exists(sessionVars['foo'])]">

Since, sometimes 'foo' is not assigned a variable.

Any ideas?

TERACytE
  • 7,553
  • 13
  • 75
  • 111

2 Answers2

6

Testing for nullity should do the trick:

<when expression="#[sessionVars['foo'] == null]">

Or, as suggested by Anton below:

<when expression="#[sessionVars.containsKey('foo')]">
n611x007
  • 8,952
  • 8
  • 59
  • 102
David Dossot
  • 33,403
  • 4
  • 38
  • 72
0

Suppose the session variable exist request_id = #[sessionVars.ses_request_id]

when you type request_id = #[sessionVars.ses_re] it will automatically shows the mule expression.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339