user2912803
user2912803

Reputation: 11

JSTL c:set dont work

I try:

<h:dataTable value="#{menuBean.modelNaglowek}" var="naglowek">
    <h:column>
        <c:set var="naglowek_id" value="#{naglowek.name}" scope="session"/>
        <f:facet name="header">Test</f:facet>
        <h:outputText value="#{naglowek.name}" />
        <h:dataTable value="#{menuBean.modelTemat}" var="temat">
            <h:column>
                <f:facet name="header">Test</f:facet>
                <h:outputText value="${naglowek_id}" />
                <h:outputText value="${temat_id}" />
                <c:if test="#{temat.naglowek.id == naglowek_id}">
                    <h:outputText value="tescik" />
                </c:if>
            </h:column>
        </h:dataTable>
    </h:column>
</h:dataTable>

But then naglowek.name in c:set is null. When I try:

<c:set var="naglowek_id" value="#{2 + 2}" scope="session"/>

then everything alright?

Upvotes: 0

Views: 828

Answers (1)

user2511414
user2511414

Reputation:

I don't see any usefull usage of set tag here!, the possible null value would be because #{naglowek.name} is really null.
the question is so why don't you print the name directly from the variable and just tying to store in some variable and point it from the variable?

<h:outputText value="#{naglowek.name}" />

Upvotes: 3

Related Questions