tags:

views:

61

answers:

1

I'm new to JSTL/EL and JSP and can't seem to find a reference which covers the following scenario:

I have an array of values in JavaScipt:

var Countries = ('US', 'CA');

I then need to check to see if the currently selected value of a standard HTML select box is in that array.

This is what I have so far:

<select id="shippingCountry">
    <option value="AT">Austria</option>
    <option value="CA">Canada</option>
    <option value="DE">Germany</option>
    //...
    <option value="US">United States</option>
</select>

<c:choose>
    <c:when test=" "> // I don't know what to put in the 'test' case
        <span class="required">*</span> 
    </c:when>
</c:choose>
+1  A: 

Since you already have the values in a Javascript array, it probably makes more sense to test for that value using Javascript. Otherwise, you'd incur a postback and it would probably be significantly more work.

composer314