1
JSF의 데이터 테이블에 표시 할 관리 빈에서 가져온 목록을 가져올 수 없습니다.관리 빈의 목록이면 데이터 테이블에 표시되지 않습니다.
디버깅 할 때 bean의 메소드를 호출 할 때 목록에 요소가 하나 있지만 페이지에는 데이터 테이블에 요소가 표시되지 않습니다.
의 관리 빈은 다음과 같습니다
@ManagedBean
@ViewScoped
public class MyBeanMB {
private List<MyBean> results = new ArrayList<MyBean>();
private MyBean myBean = new MyBean();
@EJB
private MyBeanService myBeanService;
public String findMyBeans() {
results = myBeanService.findMyBeans(myBean);
myBean = new myBeans();
if (results != null && !results.isEmpty()) {
return "success";
}
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("No results found"));
return null;
}
그리고 index.xhtml 페이지에서 양식을 다음과 같습니다 : 나는 무엇을 놓치고
<h:form>
<h:messages />
<h:outputLabel value="Nombre: " for="nombre"/>
<h:inputText id="nombre" value="#{myBeanMB.myBean.name}" />
<h:commandButton value="Buscar" action="#{myBeanMB.findMyBeans}" />
<h:dataTable id="list" value="#{myBeanMB.results}" var="item">
<h:column>
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value= "#{item.name}" />
</h:column>
</h:dataTable>
</h:form>
? 당신이 당신의 관리 빈에 success
를 반환 할 때
나는 그것에 대한 탐색 규칙을 가지고 있으며, index.xhtml로 돌아 간다 ... 그것은 무엇을 해야하는지 ...하지만 findMyBeans에서 돌아온 후 index.xhtml로 돌아갈 때 결과는 목록 하나만 있습니다. 데이터 테이블에는 아무 것도 표시되지 않습니다 ... – diminuta
즉, Luiggi의 답변을 시도하지 않았습니까? null이 아닌/void를 반환하면 새보기가 만들어집니다 (결과를 저장 한 뷰를 포함하여 모든 뷰 범위 콩이 다시 만들어집니다!) – BalusC
죄송합니다. 답변을 수락하는 데 오랜 시간이 걸렸지 만, 지금까지 시도해보십시오. S – diminuta