Link to home
Start Free TrialLog in
Avatar of jcuWM
jcuWMFlag for United States of America

asked on

Grails dropdown results from <g:select>

New Grails user using Grails 2.2.1 with an external Oracle database.

Building a drop down with a list of states. The dropdown works in the browser but it has brackets and table name with every state, like this:
{STATE_CODE=AK}

My section of list.gsp that contains the state list:

<div>
&#9;<g:if test="${params?.stateList}">
&#9;</g:if>
Select a state:<g:select name="testName" value="${STATE_CODE}" from="${params?.stateList}" /> &#9;
</div>

My section of controller.groovy file that contains the

def stateList = null
stateList = db.rows("SELECT DISTINCT STATE_CODE FROM <tablename> WHERE STATE_CODE IS NOT NULL ORDER BY STATE_CODE")
&#9;&#9;
 println "********* ${stateList.SZVSBGI_STAT_CODE}"
 params.stateList=params.stateList?:stateList
&#9;&#9;

In addition, theprintln line shows, in the command window, each state like it is supposed to. AK,AL, etc
ASKER CERTIFIED SOLUTION
Avatar of jcuWM
jcuWM
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jcuWM

ASKER

Please close this as finally one of the many trials worked.