영어로 죄송합니다. TestMB
에서JSF에서 렌더링되지 않는 AJAX
방법 delete
:
public String delete(Post post) {
getDao().delete(post);
return "success";
}
test.xhtml : 내가 링크 "델"을 클릭하면
<h:form id="form1">
<ui:repeat value="#{TestMB.entityList}" var="entityList">
<p>
#{entityList.name}
<h:commandLink action="#{TestMB.delete(entityList)}">
del
<f:ajax render=":form1"/>
</h:commandLink>
</p>
</ui:repeat>
</h:form>
페이지가 새로 고쳐지지 않습니다. 다시 클릭하면 페이지가 새로 고침됩니다. 왜?
내가 TestMB
에서 새로운 방법 delete
사용하는 경우 :
private String txt1="test";
public String delete() {
try{
Thread.sleep(Long.valueOf("10000"));
}catch(Exception ex){}
txt1="";
return "";
}
그리고 새로운 test.xhtml
가 :
<h:form id="form1">
#{testMB.txt1}
<h:commandLink action="#{testMB.delete}">
del
<f:ajax render=":form1"/>
</h:commandLink>
</h:form>
I 10 초에 링크 "델"하고 페이지 새로 고침을 클릭합니다.
첫 번째 경우에는 왜 작동하지 않습니까?
링크를 클릭하면 페이지가'success.xhtml' (접미사가 무엇이든지 암시 적 탐색으로 표시됨)으로 이동해야합니다. 'TestMB'는 첫 번째 경우에 어색해 보인다. 소문자로 시작해야합니다. 첫 번째 경우에 링크를 클릭하면 해당 작업 메서드가 제대로 호출됩니까? 제대로 호출되면 중간에 오류/예외가없는 한 대상 페이지로 이동해야합니다. – Tiny
Metod'delete'는 첫 번째 경우에 작동하며 db에서 항목을 제거합니다. 글래스 피시 로그에 오류가 표시되지 않습니다. –