It's returning an array of Strings (since this is a parameter). But if it's used one way it is treated as a single value, if it is used a slightly different way, it is treated as an array, that is not developer friendly. In this case. If it is used as:
'<s:property value="${#parameters.display}"/>' The value returned is 'dependent' which would translate to either request.getParameterValues("display")[0] or request.getParameter("display") If the code is changed very slightly to <s:property value="${#parameters.display == 'dependent'}"/> It is now treated as getParameterValues().equals("dependent") In one case it is taking the fact that the length of the array is 1 and helping out the programmer. In the other, very similar code, it is not. At the very, very least this code should be predictable, which this code is not. Either the first code should return '[EMAIL PROTECTED]' or the second should perform getParameter().equals("dependent"). Either would be acceptable. (*Chris*) On Fri, Feb 22, 2008 at 4:40 PM, Dave Newton <[EMAIL PROTECTED]> wrote: > --- Chris Pratt <[EMAIL PROTECTED]> wrote: > > On Fri, Feb 22, 2008 at 4:10 PM, Dave Newton <[EMAIL PROTECTED]> wrote: > > > --- Chris Pratt <[EMAIL PROTECTED]> wrote: > > > > I am seeing the most unexplainable results imaginable. I have the > > > > following line of OGNL: > > > > > > > > '<s:property value="%{#parameters.display}"/>' == 'dependent': > > > > <s:property value="%{#parameters.display == 'dependent'}"/> > > > > > > > > Which is outputting: > > > > > > > > 'dependent' == 'dependent': false > > > > > > > > How is that even possible? I am writing out the value of the display > > > > request parameter and it's value is the string 'dependent'. When I > > > > use the very same struts tag to evaluate the expression, it returns > > > > false? What am I missing here? > > > > > > <s:property value="#parameters.display.class"/> > > > > > > > Dave, thanks for the cryptic reply, it pointed me in the right > > direction. I wasn't crazy about OGNL before and it's stuff like this > > that makes me like it even less. > > Hmm... I haven't dug very deep, but if this is an OGNL "issue" I'd guess it's > happening somewhat earlier in the process; I'm guessing it's just returning > whatever it's finding in the map. Just a guess, though. > > > > Dave > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]