This document was generated from CDN thread
Created by: Benek Ozer on 04-11-2009 05:10:39 AM
Hello all,
I am trying to validate my session data in an action class with a code similar to this
The CVP application has a test session variable with the value "Good Test" without the "" Logically, the if statement should follow the success path. But it does not. What am I missing here?
strTest = actionAPI.getSessionData("test").toString();
if (strTest == "Good Test") {
// Success - do something
} else {
// Fail - do something else
}
Thanks
Subject: RE: session data checks in action classes
Replied by: Ranjana Narayan on 04-11-2009 05:33:12 AM
Benek,
Replace strTest == "Good Test" with strTest.equals("Good Test"). One of the caveats of Java strings, == is not the same as equals.
Hope this helps,
Ranjana.
Subject: RE: session data checks in action classes
Replied by: Benek Ozer on 04-11-2009 06:58:46 AM
Thanks Ranjana,
It worked!