아래의 데이터 테이블을 표시하려고 할 때 javax.el.PropertyNotFoundException: /member/apps/cms/edit.xhtml @228,49 value="#{props.key}": Property 'key' not found on type java.util.HashMap$Values
오류가 발생합니다.지도 키에 액세스하는 방법 jsf 데이터 테이블
<p:dataTable id="properties" var="props" value="#{contentEditorBacking.properties}" editable="true">
<p:column headerText="Property">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{props.key}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{props.key}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Value">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{props.value}" />
</f:facet>
<f:facet name="input">
<h:inputText value="#{props.value}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit">
<p:rowEditor />
<!-- Need to put an update on here yet -->
<p:commandLink styleClass="ui-icon ui-icon-trash" id="deleteProperty" actionListener="#{contentEditorBacking.deleteProperty}">
<f:attribute name="key" value="#{props.key}" />
</p:commandLink>
</p:column>
</p:dataTable>
여기 내 contentEditorBacking의 관련 부분입니다 :
@ManagedBean
@ViewScoped
public class ContentEditorBacking {
private Map<String, Properties> properties = new LinkedHashMap<String, Properties>();
public Collection<Properties> getProperties() throws Exception{
return properties.values();
}
public static class Properties{
private String key;
private String value;
public Properties(String key, String value) {
super();
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
return "key=" + key + ", value=" + value + "";
}
}
}
난 내 속성의 키 값 매핑에 액세스 할 수있는 방법을
? http://docs.oracle.com/javase/6/docs/api/java/util/Map.html
더 나은 질문은 생각입니다, 왜 당신이 당신의 자신의 클래스를 만드는 :
귀하의 XHTML 파일의 큰 부분을 게시하십시오. –
죄송합니다. 데이터 테이블 태그가 잘리지 않았습니다. 지금 거기에 있습니다. – Catfish