0
JSF 1.1을 사용하고 있습니다. 나는jsp에서 dataTable의 "var"속성 값에 대한 JSF 액세스
....
<t:dataTable id="data"
styleClass="scrollerTable"
headerClass="standardTable_Header"
footerClass="standardTable_Header"
columnClasses="col1,col2,col3"
var="product"
value="#{beanProduct.listOfProducts}"
preserveDataModel="false"
rows="10"
>
....
#{product}
와 JSP 페이지가하는 것은 state
라는 이름의 속성이 있습니다. 값이 "보류 중"이면 <h:commandButton>
을 표시하고 그렇지 않으면 아무것도 표시하지 않습니다.
#{product.state}
의 값은 JSP 스크립틀릿 코드에서 어떻게 얻을 수 있습니까?
....
<h:column>
<f:facet name="header">
<h:outputText value="#{messages['list']}" />
</f:facet>
<%
// ----> In this point, I want know the value of "product.state"
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ValueBinding binding = app.createValueBinding("#{product.state}");
Object valueOfProduct = binding.getValue(context);
String stateProduct = (String)valueOfProduct;
if (stateProduct.equals("pending")) {
%>
<h:panelGrid>
<h:commandButton value="Send" actionListener="#{beanProduct.Item}" action="#{beanProduct.sending">
<f:attribute name="idProduct" value="#{product.id}" />
</h:commandButton>
</h:panelGrid>
<%
}
else {
%>
// Do nothing.
<%
}
%>
</h:column>
</t:dataTable>
을하지만 그것은 작동하지 않습니다
나는 다음을 시도했다. 이것을 어떻게 할 수 있습니까?
두 가지 완전히 다른 프로그래밍 패러다임을 혼합하려고합니다. 일반적으로, <%/* code */%>'스크립틀릿은 전혀 사용하지 말아야합니다. – McDowell