简体   繁体   中英

Struts setter method wrong argument passing

I have a situation where in Struts application I have select tag and some values inside it

<select name='locale'>
      <option value = "DATA1">FR_DATA1</option>
      <option value = "DATA2">FR_DATA2</option>
      <option value = "DATA3">FR_DATA3</option>
      <option value = "DATA4">FR_DATA4</option>
      <option value = "DATA5">FR_DATA5</option>
 </select>

now problem is that when I submit the form the value passed to setter method of the action form is label value rather than option's value like instead of DATA1 , passing value is FR_DATA1 .

Can anybody help me? Because a setter method is calling fine, only the argument is going unexpected.

使用Struts标记而不是HTML

<s:select name="locale" list="#{'DATA1':'FR_DATA1','DATA2':'FR_DATA2','DATA3':'FR_DATA3','DATA4':'FR_DATA4','DATA5':'FR_DATA5'}"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM