简体   繁体   中英

Grails Command Object Scope

| Grails Version: 3.0.7 | Groovy Version: 2.4.4 | JVM Version: 1.8.0_60

We have a controller using a command object :

def search(SearchCommand command) {

}

The command object handles the data binding and form validation. My question is, what would be the recommended approach to retain the data in the command object between non consecutive calls.

The command object in question holds a good number of parameters used in a complex search and the reason to retain the data is to repopulate the search form each time the user returns to the search form (which may be any number of subsequent requests later).

Any recommendations greatly appreciated.

Either

  • put your command object into the session :
  • or some ConcurrentHashMap -like cache
  • or persist it in your DB

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM