0
每當我嘗試以編程方式獲取視圖對象行時,我只獲取第一行。請幫忙。以編程方式在adf視圖對象中獲取行
這裏是我的代碼:
BindingContext BContext=BindingContext.getCurrent();
System.out.println(1);
//BindingContainer bindings= (BindingContainer)bctx.getCurrent().getCurrentBindingsEntry();
BindingContainer bindings = (BindingContainer)BContext.getCurrent().getCurrentBindingsEntry();
DCBindingContainer dc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iterBind= dc.findIteratorBinding("UsersView1Iterator");
ViewObject vo=iterBind.getViewObject();
vo.executeQuery();
RowSetIterator rsIterator = vo.createRowSetIterator(null);
rsIterator.reset();
while (rsIterator.hasNext()) {
Row row = rsIterator.next();
String s=(String)row.getAttribute("Username");
String s1=(String)row.getAttribute("Password");
System.out.println(row.getAttribute("Username"));
System.out.println(row.getAttribute("Password"));
if(s.equals(user) && s1.equals(Pass)){
System.out.println(row.getAttribute("Username"));
FacesMessage fm=new FacesMessage(message.toString());
fm.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext context=FacesContext.getCurrentInstance();
context.addMessage(null, fm);
System.out.println("valid");
return "Success";
}else{
FacesMessage fm=new FacesMessage(message1.toString());
fm.setSeverity(FacesMessage.SEVERITY_INFO);
FacesContext context=FacesContext.getCurrentInstance();
System.out.println("invalid");
context.addMessage(null, fm);System.out.println(20);
return "fail";
}
}
rsIterator.closeRowSetIterator();
return null;
請你之前看一看[如何問?(http://stackoverflow.com/help/how-to-ask)問一個問題。 –