我有这个XML代码:
<extension id="free_textfield" label="Description notes" readOnly="true"/>
现在我想添加一个像
这样的参数 <extension id="free_textfield" label="Description notes" readOnly="true" text="sample string maybe with links"/>
现在我想在我的Java类中使用这个text-parameter:
public class FormExtensionExample implements IFormExtension {
public static final String ID = "free_textfield";
@Inject
private IDataService service;
@Override
public String render(IPObject object, Map<String, String> attributes) {
return null;
}
我该怎么做?
感谢您的帮助!
答案 0 :(得分:0)
您在表单配置中指定的所有属性,如下所示:
<extension id="free_textfield" label="Description notes" readOnly="true" text="sample string maybe with links"/>
可以在您必须覆盖的 attributes
方法的 render()
映射参数中找到:
@Override
public String render(IPObject object, Map<String, String> attributes) {
// here you go:
String myAttributeValue = attributes.get("text");
// the following will print "sample string maybe with links"
System.out.println(myAttributeValue);
return null;
}