1
我有3個單選按鈕,當它們被選中時,將運行不同的查詢。 我不知道if-else條件如何爲grails單選按鈕起作用,因爲我對grails是全新的。 這是我的gsp頁面。Grails If-else條件爲單選按鈕
<label>Search id:</label><input type = "text" name = "searchid1">
<input type ="submit" name ="search" value ="Go!">
<br>
<g:radio name="myGroup" value="input1"/>
<g:radio name="myGroup" value="input2"/>
<g:radio name="myGroup" value="input3"/>
,並在控制器網站的查詢..
String searchQ1 = "select * from alert_list where id = " + params.searchid1
def searchit1 = sql.rows(searchQ1)
String searchQ2 = "select * from Admin where id = " + params.searchid1
def searchit2 = sql.rows(searchQ2)
String searchQ3 = "select * from sec_user where id = " + params.searchid1
def searchit3 = sql.rows(searchQ3)
[searchit1: searchit1, searchit2: searchit2, searchit3: searchit3]