How can I pass data between GSP and controller in Grails without storing in the database? -


is possible enter data in gsp view , use data in controller inside program operations without storing data in domain. example have g:textfield , enter name. want able use name enter in controller manipulate.

none of data passed view controller has line particular domain. there couple of ways this.

the view:

<g:textfield name="name" /> 

the controller:

class somecontroller {   def someaction() {     def name = params.name     // name   } } 

you use command object.

the command object:

@validateable class somecommand {   string name    static constraints = {      name nullable: false   } } 

the controller:

class somecontroller {   def someaction(somecommand somecommand) {     if (!somecommand.haserrors()) {       def name = somecommand.name       // name     }   } } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -