grailsgroovygspgrails-controllergrails-services

How can we get GroovyfirstRowResult to just list values, and not the column headers and without flower braces when shown in .gsp view?


In the groovy Controller Code I call the function:

def wiki =   
{  
    def currentNode = params.nodePath  
    def conceptName = nodeService.retrieveConceptName (currentNode);  
    render (template:'wiki', model:[conceptName : conceptName])
}

In the service class I define the function retrieveConceptName:

def retrieveConceptName(currentNode)  
{  
    groovy.sql.Sql sql = new groovy.sql.Sql(dataSource);  
    def row= sql.firstRow(" SELECT cname FROM Person WHERE FULLNAME= ?",[currentNode]);  
    return row;  
}  

In my output(wiki template(gsp view)) I get flowerbrackets along with field header , How to get only value of column and not the flower braces or field header?


Solution

  • You haven't shown the GSP code that displays the row, but I guess it looks like either ${it} or ${row}. If so, replace it with either

    ${it.cname} or ${row.cname}