Reputation: 11
In the controller I have which is having two values say name
and amount
.
In the controller I wrote
def d=[name:amount]
render (view: "/user.gsp", model: [user: d])
and in the view
${user}
This is giving the output as {name=amount}
. But I want something like "My name and my amount".
How do I achieve that?
Upvotes: 1
Views: 1433
Reputation:
try this...
in controller
def create={
def customer = Customer.findAllByCif(cif)
def getDOnumber= '(AUTO)'
//do anything and pass to view like this.
[paramsCustomerCallat: customer, paramsparamsCustomerCallatView: getDOnumber]
}
then you receive the params like this.
<g:textField name="invoiceNo" value="${getDOnumber}" class="form-control" />
if you want to call that key
and value
in a record, i suggest you to change your code like this..
def d=[keyname:"name", keyamount:"myamount"]
render (view: "/user.gsp", model: [user: d])
then you can call like this in view
${user.keyname+" - "+user.keyamount}
Upvotes: 1