Thanks Dave... On Fri, Dec 19, 2008 at 4:22 PM, Dave Newton <newton.d...@yahoo.com> wrote:
> > http://struts.apache.org/2.x/docs/why-wont-the-if-tag-evaluate-a-one-char-string.html > > --- On Fri, 12/19/08, Raghu <techhel...@gmail.com> wrote: > > From: Raghu <techhel...@gmail.com> > Subject: [Struts2] String Comparison using s:if tag > To: "Struts Users Mailing List" <user@struts.apache.org> > Date: Friday, December 19, 2008, 4:20 PM > > > -----Inline Attachment Follows----- > > Hi, I am trying to do String comparison in s:if tag as below but getting > number format exception....Looks like some problem with expression... > > Any idea how to compare String values in s:if? > > <s:if test="user.sex == 'M'"> > Male > </s:if> > <s:elseif test="user.sex == 'F'"> > Female > </s:elseif> > > > > [WRITE4SMILE] WARN [2008/12/16 14:57:22] | Caught an exception while > evaluating expression 'user.sex == 'M'' against value stack > java.lang.NumberFormatException: For input string: "M" > at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) > at java.lang.Double.parseDouble(Unknown Source) > at ognl.OgnlOps.doubleValue(OgnlOps.java:214) > at ognl.OgnlOps.compareWithConversion(OgnlOps.java:99) > at ognl.OgnlOps.isEqual(OgnlOps.java:142) > at ognl.OgnlOps.equal(OgnlOps.java:533) > at ognl.ASTEq.getValueBody(ASTEq.java:51) > at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) > at ognl.SimpleNode.getValue(SimpleNode.java:210) > at ognl.Ognl.getValue(Ognl.java:333) > at com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:194) > at > > com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.java:258) > at > org.apache.struts2.components.Component.findValue(Component.java:322) > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >