Just FYI, I think this lesson was less about OGNL per se, and more about Java,Servlets, and the Parameter map.
#parameters.addrType is of type String[], because that's how it's collated ( since you can have multiple values to a single name.. ) hth, -a Wesley Wannemacher wrote: > > Okay, I'm officially renaming this thread - > > Learning OGNL by stabbing in the dark. > > This isn't meant to offend anyone trying to help me because I really > appreciate it! It's just because, rather than read the docs, I decided to > figure this out by brute force (as you'll see below). > > I should have tried the obvious earlier, but it turns out the easiest > correct syntax is this: > > <s:property value='addrType == "billing"'/> > > In case you're wondering about whatever else works, here is my final > attempt: > > ---CODE--- > <p class="sectionSubTitle"> > Please verify the details of your <s:property > value="#parameters.addrType"/> > address below - > </p> > <br />1 <s:property value='#parameters.addrType == "billing"'/> > <br />2 <s:property value='%{#parameters.addrType == "billing"}'/> > <br />3 <s:property value='#parameters.addrType eq "billing"'/> > <br />4 <s:property > value='%{#parameters.addrType.toString().equals("billing")}'/> > <br />5 <s:property > value='%{#parameters.addrType.toString().trim().equals("billing")}'/> > <br />6 <s:property value='%{#parameters.addrType eq "billing"}'/> > <br />7 <s:property > value='#parameters.addrType.toString().equals("billing")'/> > <br />8 <s:property > value='#parameters.addrType.toString().trim().equals("billing")'/> > <br />9 <s:property value="#parameters.addrType == 'billing'"/> > <br />10 <s:property value="%{#parameters.addrType == 'billing'}"/> > <br />11 <s:property value="#parameters.addrType eq 'billing'"/> > <br />12 <s:property > value="%{#parameters.addrType.toString().equals('billing')}"/> > <br />13 <s:property > value="%{#parameters.addrType.toString().trim().equals('billing')}"/> > <br />14 <s:property value="%{#parameters.addrType eq 'billing'}"/> > <br />15 <s:property > value="#parameters.addrType.toString().trim().equals('billing')"/> > <br />16 <s:property > value="#parameters.addrType.toString().equals('billing')"/> > <br />17 <s:property value='#addrType == "billing"'/> > <br />18 <s:property value='%{#addrType == "billing"}'/> > <br />19 <s:property value='#addrType eq "billing"'/> > <br />20 <s:property value='%{#addrType.toString().equals("billing")}'/> > <br />21 <s:property > value='%{#addrType.toString().trim().equals("billing")}'/> > <br />22 <s:property value='%{#addrType eq "billing"}'/> > <br />23 <s:property value='#addrType.toString().equals("billing")'/> > <br />24 <s:property > value='#addrType.toString().trim().equals("billing")'/> > > <br />25 <s:property value="#addrType == 'billing'"/> > <br />26 <s:property value="%{#addrType == 'billing'}"/> > <br />27 <s:property value="#addrType eq 'billing'"/> > <br />28 <s:property value="%{#addrType.toString().equals('billing')}"/> > <br />29 <s:property > value="%{#addrType.toString().trim().equals('billing')}"/> > <br />30 <s:property value="%{#addrType eq 'billing'}"/> > <br />31 <s:property > value="#addrType.toString().trim().equals('billing')"/> > <br />32 <s:property value="#addrType.toString().equals('billing')"/> > <br />33 <s:property value='addrType == "billing"'/> > <br />34 <s:property value='%{addrType == "billing"}'/> > <br />35 <s:property value='addrType eq "billing"'/> > <br />36 <s:property value='%{addrType.toString().equals("billing")}'/> > <br />37 <s:property > value='%{addrType.toString().trim().equals("billing")}'/> > <br />38 <s:property value='%{addrType eq "billing"}'/> > <br />39 <s:property value='addrType.toString().equals("billing")'/> > <br />40 <s:property > value='addrType.toString().trim().equals("billing")'/> > <br />41 <s:property value="addrType == 'billing'"/> > <br />42 <s:property value="%{addrType == 'billing'}"/> > <br />43 <s:property value="addrType eq 'billing'"/> > <br />44 <s:property value="%{addrType.toString().equals('billing')}"/> > <br />45 <s:property > value="%{addrType.toString().trim().equals('billing')}"/> > <br />46 <s:property value="%{addrType eq 'billing'}"/> > <br />47 <s:property > value="addrType.toString().trim().equals('billing')"/> > <br />48 <s:property value="addrType.toString().equals('billing')"/> > <br />49 <s:property value="%{addrType} == 'billing'"/> > <br />50 <s:property value="addrType == 'notBilling'" /> > > ---OUTPUT--- > <p class="sectionSubTitle"> > Please verify the details of your billing address below - > </p> > <br />1 false > <br />2 false > <br />3 false > <br />4 false > <br />5 false > <br />6 false > <br />7 false > <br />8 false > <br />9 false > <br />10 false > <br />11 false > <br />12 false > <br />13 false > <br />14 false > <br />15 false > <br />16 false > <br />17 false > <br />18 false > <br />19 false > <br />20 > <br />21 > <br />22 false > <br />23 > <br />24 > <br />25 false > <br />26 false > <br />27 false > <br />28 > <br />29 > <br />30 false > <br />31 > <br />32 > <br />33 true > <br />34 true > <br />35 true > <br />36 true > <br />37 true > <br />38 true > <br />39 true > <br />40 true > <br />41 true > <br />42 true > <br />43 true > <br />44 true > <br />45 true > <br />46 true > <br />47 true > <br />48 true > <br />49 > <br />50 false > >> -----Original Message----- >> From: Alexandre Mendonça Lima >> [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, January 23, 2007 2:23 PM >> To: Struts Users Mailing List >> Subject: Re: [s2] String comparison with OGNL >> >> I see something in the Guide page about this way: >> <s:property value='%{#parameters.addrType == "billing"}'/> >> >> Alexandre Lima >> >> ----- Original Message ----- >> From: "Wesley Wannemacher" <[EMAIL PROTECTED]> >> To: "Struts Users Mailing List" <user@struts.apache.org> >> Sent: Tuesday, January 23, 2007 3:44 PM >> Subject: RE: [s2] String comparison with OGNL >> >> >> > Nope, same result... Here is the code and output - >> > >> > ---CODE >> > <p class="sectionSubTitle"> >> > Please verify the details of your <s:property >> > value="#parameters.addrType"/> >> > address below - >> > </p> >> > <s:property value="%{#parameters.addrType == 'billing'}"/> >> > >> > ---RESULT >> > <p class="sectionSubTitle"> >> > Please verify the details of your billing address below - >> > </p> >> > false >> > >> > >> > I'm not sure how much it matters, but I am working with a >> snapshot of >> > 2.0.2 >> > that I built a while back. If this is an issue, I can >> replace any jars to >> > see if that fixes the problem. >> > >> > -Wes >> > >> >> -----Original Message----- >> >> From: Dave Newton [mailto:[EMAIL PROTECTED] >> >> Sent: Tuesday, January 23, 2007 1:36 PM >> >> To: Struts Users Mailing List >> >> Subject: RE: [s2] String comparison with OGNL >> >> >> >> From: Wesley Wannemacher [mailto:[EMAIL PROTECTED] >> >> > <s:property value="#parameters.addrType == 'billing'"/> >> >> >> >> Does wrapping it with %{} do it? >> >> >> >> <s:property value="%{#parameters.addrType == 'billing'}"/> >> >> >> >> I still get a little confused when dealing with the >> different markups. >> >> >> >> 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] >> >> > > > -- View this message in context: http://www.nabble.com/RE%3A--s2--String-comparison-with-OGNL----Learning-OGNL-by-stabbing-in-the-dark.-tf3077206.html#a8550782 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]