*Background:
In a different thread, the following was discussed:

On Thu, May 19, 2011 at 2:22 PM, Eric Lentz wrote:
> I'm curious. If you are using ModelDriven, then why do you load your 
model
> in prepare()? Why not in getModel?

That'd mean you'd need the "did I already load the model?" code in
getModel(), wouldn't it? Seems cleaner to use prepare, since that's
what it's for.

Dave

*Question:
So my question is this: What is getModel supposed to be used for? I 
apparently was naively thinking it was for, well... "getting the model." 
Javadoc says this about the method, "Gets the model to be pushed onto the 
ValueStack instead of the Action itself." That seems to indicate that 
getModel is for getting the model.

On the Model Driven Interceptor documentation page (
http://struts.apache.org/2.2.1/docs/model-driven-interceptor.html), it 
says, "In the implementation of getModel, acquire an instance of a 
business object and return it." That also seems to indicate that one 
should get the model, but says nothing about the issues raised in this 
forum.

My code has addressed the "did I already load the model" issue, but I was 
unfamiliar with that issue from looking at any documentation on the site. 
I had to discover that on my own. Isn't that a problem that should be 
addressed in some manner (i.e., updated documentation)? Alternately, 
should these issues be somehow addressed programmatically in the 
framework?

- Eric

Reply via email to