开发者

dataTable, inputText and value saving of a "not direct" bean variable

I开发者_如何学编程 have a dataTable with a list of inputTexts:

<h2>
    Attributes
</h2>
<h:dataTable
    value="#{detailModel.getAfterObjectAttributeSpecifications()}"
    var="specification"
    styleClass="waiFormTable" >
    <h:column>
        #{specification.name}:
    </h:column>
    <h:column>
        <h:inputText id="attribute" value="#{detailModel.getAfterObjectAttribute(specification.name)}" disabled="#{detailModel.mode == detailModel.viewMode}"/>  
    </h:column>
</h:dataTable>

The value of the inputText is not a direct bean field (detailModel.getAfterObjectAttribute(specification.name)). If I change the value and want it save, how should I do?

Thank you for any help Francesco


You can't. It has to be a real property or at least a Map value. E.g.

<h:dataTable
    value="#{detailModel.afterObjectAttributeSpecifications}"
    var="specification"
    styleClass="waiFormTable" >
    <h:column>
        #{specification.name}:
    </h:column>
    <h:column>
        <h:inputText id="attribute" value="#{detailModel.afterObjectAttributes[specification.name]}" disabled="#{detailModel.mode == detailModel.viewMode}"/>  
    </h:column>
</h:dataTable>

with

public Map<String, String> getAfterObjectAttributes() {
    return afterObjectAttributes;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜