如何渲染另一个?a4j:commandLink
_ 在中,当我单击部门编辑时,无法渲染部门。我也尝试使用它不起作用并且没有显示任何错误。我不知道为什么。dataTable
UI Component
h:form
tableForm
a4j:commandLink
datatable
ajax
entryForm
ajax:region
<!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());
}
}