----- Original Message ----- From: "Bill Lynch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 08, 2003 11:54 PM Subject: Re: [OS-webwork] ww1.3 - ActionContext getPrincipal
> Mike, > > Just noticed an error in your syntax: > > > <ww:bean name="'webwork.action.ActionContext'" id="actionContext"> > > <ww:if test="principal != null"> > > Principal <ww:property value="principal"/> is logged in > > </ww:if> > > </ww:bean> > > That if should be: > > <ww:if test="principal"> > Principal <ww:property value="principal" /> is logged in > </ww:if> > > The WW EL is *really* confusing when it comes to null tests IMO. > test="principal" means "principal != null" and test="!principal" means > "principal == null". > > Your example probably works because "null" is meaningless in the WW EL > so "principal != null" probably evaluates to true just like "principal". You are right that null is not a keyword in the WW EL. Therefore writing null means that WW looks for a method getNull() on the value stack, and normally it would not find such a method and return the value null which is what you intended, luckily! In the current WW1.3 CVS I have added null as a keyword to the EL so you can now use it safely in expressions, and more importantly in method calls. Concerning the boolean vs null test I agree that it can be confusing. It would not be hard to change it, but then I guess many existing applications would break. Cheers, Dick Zetterberg [EMAIL PROTECTED] > > I haven't been following the list too closely for WW2 - is this > something that could be cleared up for the next version? To me, I'd make > a lot more sense if test="foo" was a boolean test and "null" had meaning. > > Cheers, > --Bill > ------------------------------------------------------- This SF.Net email sponsored by: Parasoft Error proof Web apps, automate testing & more. Download & eval WebKing and get a free book. www.parasoft.com/bulletproofapps _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork