views:

18

answers:

0

Hi

Is it possible to persist data in bean between each method calls MultiActionController?

fist method should be able to create new Person and the second method should be able to use the object

I have tried the following not sure why UI Model is created for every method call?

I am expecting a “myUser” (UI model) to bind to form fields which is happening, but since for every method call a new “myUser” is create (highlighted below in logs) it is not possible to retrieve data for both client & server side validations

To bind Object to request here’s what I do

@Override 

       protected void bind(HttpServletRequest request, Object command)-----  myUser is passed throws Exception {

             logger.info("bind : " +   MyServiceForm.class.isInstance(command));

             ServletRequestDataBinder binder = createBinder(request, command); 

             binder.bind(request); 

             errors = binder.getBindingResult(); 

       }

On the jsp page

<form:form method="post" commandName="command" >

<spring:bind path="command.userName"><td><form:input path="userName" size="20"/> </td></spring:bind>           

<form:errors path="userName" />

</form:form>

com.demo.ui.controller.MyUserController$$EnhancerByCGLIB$$73d75f23.getLastModified([Ljava.lang.Object;@1095c6c)([org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper@1eb84f]) execution time: 0 ms

13:24:06,945 DEBUG [MyUserController] Creating new command of class [java.lang.Object]

271189 [http-8080-1] DEBUG com.demo.ui.controller.MyUserController - Creating new command of class [java.lang.Object]

13:24:06,945 INFO [MyUserController] call from loadpage: -----------> this is a method

271189 [http-8080-1] INFO com.demo.ui.controller.MyUserController - call from loadpage:

com.demo.ui.controller.MyServiceController$$EnhancerByCGLIB$$73d75f23.getLastModified([Ljava.lang.Object;@41f871)([org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper@1c83d89]) execution time: 0 ms

13:24:14,429 DEBUG [MyUserController] Creating new command of class [com.demo.uimodel.MyUserController]

278673 [http-8080-2] DEBUG com.demo.ui.controller.MyUserController - Creating new command of class [com.com.demo.uimodel.MyUserForm]

13:24:14,429 INFO [MyUserController] MyUserController validation reference : ---> this a mehtod

278673 [http-8080-2] INFO com.demo.ui.controller.MyUserController - MyUserController validation reference :

13:24:14,429 INFO [MyUserController] call validate:

Thanks