I have the following form:
public class ChildcareWorkerAdvertisementForm extends AbstractForm<ChildcareWorkerAdvertisement> {
@Valid
@Override
//Rename the property from "model" to "advertisement"?
public ChildcareWorkerAdvertisement getModel() {
return super.getModel();
}
}
I would like to rename the property named model
to something else, perhaps advertisement
when binding occurs so that I can refer to it as advertisement
in the view (thymeleaf, etc...).
Is this possible using Spring MVC?
edit 1: Here is my application' AbstractForm
class:
package com.bignibou.web.controller;
public class AbstractForm<T> {
private T model;
public T getModel() {
return this.model;
}
public final void setModel(T model) {
this.model = model;
}
...
You can see it uses Generics which is very neat on the java part. However I would like to customize the name of the model
property in the views hence my question.
You can try following in your controller