我正在尝试从后台办公室控制台的文本框中获取输入。获取输入的正确方法是什么?
我尝试了以下链接:
https://hybrisdiary.com/2018/10/15/backoffice-customization/
public class MyCustomInputController extends DefaultWidgetController
{
private Textbox textInput;
@Override
public void initialize(final Component comp)
{
super.initialize(comp);
}
@ViewEvent(componentID = "submitButton", eventName = Events.ON_CLICK)
public void doOperation()
{
textInput.getText()
//This is throwing a Null Pointer Exception
}
}
预期结果:从以下字段获取输入:
<textbox id="textInput"/>
实际结果:空指针接收
答案 0 :(得分:1)
单个后台元素必须带有@Wire
批注声明。
@Wire
private Textbox textInput;