Results 1 to 2 of 2
  1. #1
    SomeoneHere is offline Member
    Join Date
    Jan 2012
    Posts
    9
    Rep Power
    0

    Default Problem with <s:if> and string

    Hi

    I have code
    Java Code:
    <s:form action="SwitchActive" method="POST">
       <s:hidden name="isActive" value="%{isActive}" />
       <s:if test="%{#isActive=='Y'}">
          <s:submit value="ACTIVE" name="switchActiveButton" />
       </s:if>
       <s:else>
          <s:submit value="INACTIVE" name="switchActiveButton" />
       </s:else>
    </s:form>
    isActive is equal to 'Y' (checked in generated page), but button has value "INACTIVE". How should I compare variable with string? Google says that my way is correct, but it still doesn't work...

  2. #2
    SomeoneHere is offline Member
    Join Date
    Jan 2012
    Posts
    9
    Rep Power
    0

    Default Re: Problem with <s:if> and string

    ok, found workaround (or just working way?)
    Java Code:
    <s:set name="isActiveVar" value="%{isActive}" />
    <s:form action="SwitchActive" method="POST">
       <s:hidden name="isActive" value="%{isActive}" />
       <s:if test="%{#isActiveVar==\"Y\"}">
          <s:submit value="ACTIVE" name="switchActiveButton" />
       </s:if>
       <s:else>
          <s:submit value="INACTIVE" name="switchActiveButton" />
       </s:else>
    </s:form>

Similar Threads

  1. Having a problem with to String
    By thorobred in forum New To Java
    Replies: 20
    Last Post: 06-02-2012, 09:24 AM
  2. Problem splitting a string
    By sehudson in forum New To Java
    Replies: 2
    Last Post: 03-13-2011, 09:56 PM
  3. SIMPLE String problem
    By vince_enzwo in forum New To Java
    Replies: 15
    Last Post: 02-13-2011, 05:06 PM
  4. Replies: 6
    Last Post: 12-06-2010, 10:26 AM
  5. String Problem
    By gnomewise in forum New To Java
    Replies: 1
    Last Post: 10-19-2008, 01:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •