struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Sánchez <>
Subject ModelDriven and ParamsPrepareParams
Date Thu, 08 May 2014 07:27:38 GMT

I have found problems using MD and PPP together, Struts2 complains (and 
errors are displayed in view) that no setter method was found because at 
first Params run, model is not yet instantiated. I am asking for which 
of the following approaches is the most recommended one:

1. Define a custom interceptor stack MPPP (ModelParamsPrepareParams), so 
model is instantiated before first params.

1.1. I have read [1] than moving ModelDriven would not be enough, but a 
MPPMP is required. Is this right?

2. [my preferred one] Define a (redundant) id property in the action and 
use it in the action and in the view instead of the id property of the 
model. I mean, instead of:

     public void prepare() throws Exception {
         if (person.getId()  != null) {
             person = service.getPerson(person.getId());
         } else {
             person = new Person();


     public void prepare() throws Exception {
         if (personId  != null) {
             person = service.getPerson(personId);
         } else {
             person = new Person();

doing the same in the view, using personId appropriately instead of 
(model) id.

3. Do not use ModelDriven.

Any other one? Is this issue documented?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message