groovy - Do I have to do something special for command objects to get instantiated in grails? -


I have a command object in my package from my controller. I import it into the controller I create and Return an action to create an example:

  def create = {def reportCreateCommand = new ReportCreateCommand () report CreateCommand.name = params.name reportCreateCommand.jrxmlFile = params.jrxmlFile return [Cmd: reportCreateCommand ]}  

But by closing the save process, the properties do not instantaneously trigger the object of this command :

  def save = {ReportCreateCommand CMD -> If (CMD.Validet ()) (DR Report Interstice = CMD.Sent Report () reportinense.Save () Redirect (Action: "Show", ID: ReportInstance.Id)} FIFI {Render (see: "Create", Model: [CMD: CMD]}}}  

Apparently the CMD is zero in stopping the remaining. The command class has two property names and jrxmlFile. I know that the grave objects should be converted to grells in ways to save the parameters. Do I have to do something else?

I believe calling cmd.validate () is unnecessary , You should just call cmd.hasErrors () .

Command object will be valid by default on the creation of an object

Comments