Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
String comparison with OGNL -- Learning OGNL by stabbing in the dark.

String comparison with OGNL -- Learning OGNL by stabbing in the dark.

2007-01-23       - By Wesley Wannemacher

 Back
Reply:     1     2  

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:alexandre.lima@(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" <WesW@(protected)>
> To: "Struts Users Mailing List" <user@(protected)>
> 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:DNewton@(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:WesW@(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: user-unsubscribe@(protected)
> >> For additional commands, e-mail: user-help@(protected)
> >>
> >>
> >
>
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

©2008 junlu.com - Jax Systems, LLC, U.S.A.