I have one domain, in that domain more than 25 members are there. This members value will come from one form. But it feels bad to fill those too much fields. So I thought dividing input form into different stages.
I've made a class called FormObject that has fields for ALL the input needed. The problem is theres no way to pass this object between pages.
I was thinking maybe a service with the scope of session would allow me to keep a reference to a FormObject and just call a method from the service to get it again.
<g:set var="formService" value="${new FormService()}" />
class FormService{
static transactional = false
static scope = "session"
FormObject myObject = new FormObject()
def resetForm(){
myObject=new FormObject()
}
def getForm(){
return myObject
}
}
and used that into GSP like
<g:set var="myForm" value="${formService.getForm()}" />
However the data doesn't persist between pages.
It does persist if I define the myObject property as static, but I'm worried that when this hits production, the myObject will be shared across all users.
Can anyone confirm what would happen if I made it static? Would each session have a static form object or would there only be one static form object?