我是gwt.i中的新手想要在html列表框中添加来自服务器端的数据,那么如何才能做到这一点? name是拆分字符串,我想在列表框中添加... 实际上我想制作jqxlistbox类型模块。http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxlistbox/index.htm
public class imagegrid implements EntryPoint
{
Label l = new Label("search");
TextBox tb=new TextBox();
VerticalPanel panel=new VerticalPanel();
String name=null;
private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
public void onModuleLoad()
{
tb.addKeyUpHandler(new handler());
panel.add(l);
panel.add(tb);
RootPanel.get().add(panel);
}
public class handler implements KeyUpHandler
{
public void onKeyUp(KeyUpEvent event)
{
String ab =tb.getText();
if(ab.length()>0)
{
greetingService.server(ab,new AsyncCallback<String>()
{
@Override
public void onFailure(Throwable caught)
{
Window.alert("Invalid");
}
@Override
public void onSuccess(String result)
{
System.out.println("At the client side..."+result);
if(result.isEmpty())
{
name="not found";
}
else
{
String match=tb.getText();
for (String retval: result.split("/"))
{
name=retval;
}
}
}
});
}
}
}
}