要讓 Select 設定預設的選項可以參考 https://struts.apache.org/docs/select.html 的範例
<
s:select
label="Months"
name="months"
headerKey="-1" headerValue="Select Month"
list="#{'01':'Jan', '02':'Feb', [...]}"
value="selectedMonth"
required="true"
/>
// The month id (01, 02, ...) returned by the getSelectedMonth() call
// against the stack will be auto-selected
範例的意是是說,當 Action 執行時,會先呼叫
getSelectedMonth() 這個 method,只要在這個 method 中回傳值,就可以有預設選項了.
https://struts.apache.org/docs/select.html
沒有留言:
張貼留言