3

我们有一个使用 JSF 1.1 运行的旧应用程序,由于客户端规范无法升级。

我想知道是否可以使用 JSF 1.1 创建一个数据表,并在单击数据表行中的按钮或链接时打开一个对话框弹出窗口并执行 CRUD 操作?

谢谢

编辑 1

我猜 Apache Trinidad 支持 JSF 1.1。我可以在特立尼达进行 CRUD 操作吗?

4

1 回答 1

1

我认为将 Richfaces 3.1.6(与 JSF 1.1 兼容)与出色的 A4J 结合使用会帮助您做到这一点:

<h:form id="myForm">
<rich:dataTable width="100%" style="border:none;margin-left:15px;" id="tableId" columnClasses="colClass"
            value="#{managedBean.someList}" var="someVar">

    <h:column> some content for this column </h:column>
    <h:column>
           <a4j:commandLink styleClass="linkClass" value="Delete" reRender="myForm:myModal" ajaxSingle="true" oncomplete="#{rich:component('myForm:myModal')}.show()" actionListener="#{managedBean.someMethodToUpdateDTO}">
              <a4j:actionparam value="#{someVar.idForExample}" name="someName"  assignTo="#{managedBean.someDTOObjectToBeUpdated.id}"/>
           </a4j:commandLink>

    </h:column>
</rich:dataTable>

<rich:modalPanel id="panel" width="350" height="100">
    <f:facet name="header">
    <h:panelGroup>
        <h:outputText value="Are you really, really sure to delete this one!!! #{managedBean.someDTOObjectToBeUpdated.name}"></h:outputText>
    </h:panelGroup>
    </f:facet>
    <a4j:commandButton styleClass="btnClass" value="Oui" ajaxSingle="true" oncomplete="#{rich:component('myForm:myModal')}.hide()" reRedner="myForm:tableId" action="#{managedBean.deleteIt}">
</rich:modalPanel>

</h:form>

someMethodToUpdateDTO 是一个方法,在您的托管 bean 中如下所示:

public void someMethodToUpdateDTO(ActionEvent event){
    //In this method I just load the object from somewhere else
    someDTOObjectToBeUpdated = someDAO.getObject(someDTOObjectToBeUpdated.getId()); 
    //someDTOObjectToBeUpdated is an attribute of your managed bean, of course with its     getter and setter
}

希望这可以帮助,

干杯

于 2013-03-21T22:23:59.977 回答