Search code examples
javajspjakarta-eestruts2ognl

Struts 2 - Select default value


I had two select like this :

<s:select label = "Pays " list="payss" key="pays" value="%{FRANCE}"></s:select>
<s:select label = "Categorie " list="categories" key="categorie" value="%{200}">/s:select>

The second default value works but the first is not, the lists are like this :

payss:

  1. FRANCE
  2. BELGIQUE

categories:

  1. 200
  2. 300

Solution

  • Try

    value="%{'FRANCE'}"
    

    OGNL is looking for the variable FRANCE and couldn't find it, because you didn't use it in the valueStack.