Anyone already get to work with a AbstractIterationElementProcessor derived class in a spring project which uses Thymeleaf? I am trying use this to implement this kind of tag:
<form:form ...>
...
</form:form>
The element is iterated based on a List which should be generated inside the processor class, based on the array with the list of field of the class from model class passed to the view (named command).
In each iteration, one element of the list is processed by a switch-like structure inside the tag and a inner element is chosen (form:input, form:select, etc).
Right now, I have this code:
public class FormProcessor extends AbstractIterationElementProcessor {
public FormProcessor() {
super("form");
}
@Override
public void processClonedHostIterationElement(Arguments arguments, Element iteratedChild) {
//
}
@Override
public String getIteratedElementName(Arguments arguments, Element element) {
return "form";
}
@Override
public boolean removeHostIterationElement(Arguments arguments, Element element) {
return false;
}
@Override
public AbstractIterationElementProcessor.IterationSpec getIterationSpec(Arguments arguments, Element element) {
return null;
}
@Override
public int getPrecedence() {
return 1000;
}
}
But I am have some trouble to understand what implement in each method. Anyone can give a hint on how to do that?
Aucun commentaire:
Enregistrer un commentaire