1

I have a dataTable displaying data of type Action. I have a column named "Status" which will be set by the user. After setting this column I want to retrieve the value from a HashMap with Action class as key and the status as value.

How could I do it directly in the dataTable status column? I attempted the following:

<p:dataTable var="currentExecutedTestAction" value="#{projectCampaignManagementMB.currentExecutedTestActionList}">
    <p:column>  
        <f:facet name="header">  
            <h:outputText value="Status" />  
        </f:facet>  
        <h:outputText value="#{projectCampaignManagementMB.actionMap(currentExecutedTestAction,statusValue)}" /> 
    </p:column>
</p:dataTable>
2
  • <h:outputText value="#{projectCampaignManagementMB.actionMap[someKey]}"/> this ? <h:outputText value="#{projectCampaignManagementMB.actionMap[statusValue]}"/> this ? Commented Oct 30, 2012 at 9:42
  • i mean like this in java actionsMap.put(action, status); Commented Oct 30, 2012 at 10:10

1 Answer 1

1

Just use the action as a key (I suppose that the action is some String/Integer etc that can be used as a key).

<h:outputText value="#{projectCampaignManagementMB.actionMap[action]}"/>

JSF will use the action as a key to get the value, and than after you will submit some new value it will use action again to set the new value.

Sign up to request clarification or add additional context in comments.

2 Comments

action is of type Action class, if i understand you when i set the status value which a string it will be associated to the current row action .<h:outputText value="#{projectCampaignManagementMB.actionMap[currentExecutedTestAction]}"/> is it right ? and many thanks for your help :))
Yes , so you can use it like this <h:outputText value="#{projectCampaignManagementMB.actionMap[action.someKey]}"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.