a4j:commandLink
은 dataTable
에 UI Component
중 하나를 h:form
으로 렌더링합니까? tableForm
에 datatable
부서의 a4j:commandLink
을 클릭하면 ajax
이 부서의 entryForm
을 렌더링 할 수 없습니다. 또한 ajax:region
을 사용해도 작동하지 않으며 오류가 표시되지 않습니다. 이유를 모르겠습니다.Richfaces 4, a4j : 다른 h : 형식을 렌더링하는 명령
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
template="/layout/adminTemplate.xhtml">
<ui:define name="body">
<h:form id="entryForm">
<h:outputText value="Edit Department" styleClass="subTitle"/>
<h:panelGrid columns="2">
<h:outputText value="Name : " styleClass="inputLabel"/>
<h:inputText value="#{ManageDepartmentAction.department.name}" styleClass="inputText"/>
<h:outputText value="Description : " styleClass="inputLabel"/>
<h:inputTextarea value="#{ManageDepartmentAction.department.description}" cols="50" rows="6"/>
</h:panelGrid>
<h:commandButton id="editBtn" value="Edit" action="#{ManageDepartmentAction.editDepartment}"/>
</h:form> <br/>
<h:form id="tableForm">
<rich:dataTable value="#{ManageDepartmentAction.departmentList}" var="dep" id="departmentTable"
style="width:100%" rowKeyVar="index">
<rich:column sortBy="#{dep.id}" style="width:200px;">
<f:facet name="header">
<h:outputText value="Department ID"/>
</f:facet>
<h:outputText value="#{dep.id}" styleClass="tableContent"/>
</rich:column>
<rich:column sortBy="#{dep.name}">
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:outputText value="#{dep.name}" styleClass="tableContent"/>
</rich:column>
<rich:column sortBy="#{dep.description}">
<f:facet name="header">
<h:outputText value="Description"/>
</f:facet>
<h:outputText value="#{dep.description}" styleClass="tableContent"/>
</rich:column>
<rich:column style="width:100px;text-align:center;">
<a4j:commandLink value="Edit-1" action="#{ManageDepartmentAction.prepareEditDepartment(dep)}" render="entryForm"/>
<a4j:commandLink value="Edit-2" action="#{ManageDepartmentAction.prepareEditDepartment(dep)}" render=":entryForm"/>
<a4j:commandLink value="Edit-3" action="#{ManageDepartmentAction.prepareEditDepartment(dep)}" render="tableForm :entryForm"/>
</rich:column>
</rich:dataTable>
</h:form>
</ui:define>
</ui:composition>
@Scope(CONVERSATION)
@Name("ManageDepartmentAction")
public class ManageDepartmentAction {
public List<Department> departmentList;
@In("#{DepartmentService}")
private IDepartmentService departmentService;
@Out(value = "department", required = false)
private Department department;
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
public boolean isCreateNew() {
return createNew;
}
@Begin(nested = true)
public void init() {
departmentList = departmentService.findAllDepartments();
}
public List<Department> getDepartmentList() {
return departmentList;
}
public void prepareEditDepartment(Department department) {
this.department = department;
}
public void editDepartment() {
System.out.println("Edit Department Name : " + department.getName());
}
}
': form2'처럼 전체'h : form'을 렌더링하고 싶습니다. ''또는''는'DataTable'에 있어야합니다. –
CycDemo