Re: String variable with a number s:if test

Lukasz Lenart <[email protected]>
Newsgroups gmane.comp.jakarta.struts.devel
Message-ID <CAMopvkMdyRTTKT37+9kqYHEQ-H_RGDFOKY32Lmfk7FKjCYRSXA@mail.gmail.com>
śr., 24 maj 2023 o 11:23 Greg Huber <[email protected]> napisał(a):
>
> If I have a bean with a variable of type of String
>
> ie public String getType() { return type; }
>
> AND it has a number, eg 2.
>
> In my jsp
>
> Does not work:
>
> <s:if test="bean.type.equals('2')">
>
> I must use this:
>
> <s:if test="bean.type == 2">
>
> Is this how it should work?
>
> ....Some old code uses .equals('2'), as the bean is a string, and is not
> working as expected.🙁  Maybe it has always been wrong?

Did you try to use:

<s:if test='bean.type.equals("2")'>

?

As '*' indicates a char


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.