I feel really dumb for asking this, but I'm going insane. I'm looking to use
the ask tag in a script and then do different things depending on the
answer. My code is similar to this:

<i:ask question="Which thing are you using: This, Other? (t,o) "/>
<log:warn>User typed: '${interact.answer}'</log:warn>
<j:choose>
  <j:when test="${interact.answer.equalsIgnoreCase('t')}">
    <echo message="Using This"/>
  </j:when>
  <j:when test="${interact.answer == 'o'}">
    <echo message="Using Other"/>
  </j:when>
  <j:otherwise>
    <echo message="None chosen"/>
  </j:otherwise>
</j:choose>

When I run this, I get the following output:

Which thing are you using: This, Other? (t,o)
t
User typed: 't'
[echo] None chosen

Typing 'o' also gets the "None chosen" echo from the otherwise case, so it
looks like that neither of the tests works they way I'm expecting.

Most of the sample scripts I can find use the ${interact.answer == 'o'}
syntax. If I throw that in a log, it always returns false (which is sort of
expected, because it would do the same in Java).

If I through the ${interact.answer.equalsIgnoreCase('t')} into a log
message, it seems to evaluate to null. So, as far as I can tell, I'm using
the wrong syntax for my test. What is the correct syntax?

I'm sure the solution to this is quite trivial, so sorry for polluting the
list with it. Any help would be appriciated, however. Also, if anyone can
point me to decent sample scripts, or otherwise point me to somewhere where
I could have found this information without posting here, I'd appriciate
that as well. 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to