userYuri
userYuri

Reputation: 47

Failed to compare strings in jsp

I have a url that looks like this

....aaa=bbb&tab=second

in jsp I compare:

<s:if test="%{#parameters['tab']=='second'}">

it returns false.... I can see the value 'second' from here:

<s:property value="#parameters['tab']"/>

but this displays false:

<s:property value="%{#parameters['tab']=='second'}"/>

Any idea why it does that? Thank you, Yuri

Upvotes: 1

Views: 652

Answers (1)

MohanaRao SV
MohanaRao SV

Reputation: 1125

parameters returns string array not string. Yes, a named parameters might have multiple values like tab=first&tab=second that's why it's string array instead of string.

<s:if test="%{#parameters['tab'][0]=='second'}">

</s:if>

Upvotes: 1

Related Questions