【发布时间】:2014-12-13 21:50:41
【问题描述】:
在我目前的春季项目中,如果我有这样的标签:
<thform:form attr1="..." attr2="...">
...
</thform:form>
由这个百里香处理器处理:
public class Form extends AbstractProcessor {
@Override
public ProcessorResult doProcess(Arguments arguments,ProcessorMatchingContext context,Node node) {
Element form = new Element("form");
form.setProcessable(true);
form.setAttribute("role", "form");
form.setAttribute("class", "form");
form.setAttribute("action", "");
form.setAttribute("method", "post");
node.getParent().insertBefore(node, form);
return ProcessorResult.OK;
}
@Override
public int getPrecedence() {
return 0;
}
@Override
public IProcessorMatcher<? extends Node> getMatcher() {
return new ElementNameProcessorMatcher("form");
}
}
我如何读取attr1 和attr2 的值?
【问题讨论】: