IntelliJ warns "Cannot resolve variable" on EL variables declared in parent page of include

2.4k views Asked by At

I have created a table column which is defined in its own include file. This column is used by <ui:include> in a few other Facelets pages to be used in some datatables. The include column uses a variable called "linje" (which is a java class), which is defined in the parent page that includes the column.

Even though the code works, I cannot navigate to the java-class from the included file in IntelliJ. Is there some way to do this? I also get a lot of warnings from IntellJ "Cannot resolve variable "linje".

Code that uses the column

<rich:dataTable value="#{someMBean.someLinjeModel}"
                        reRender="ds-h" var="linje" id="vt"
                        rows="#{someBean.rows}" styleClass="standard"
                        rowClasses="odd,even">

            <ui:include src="someColumn.xhtml"></ui:include>

Code from someColumn.xhtml

<rich:column id="status" rendered="#{!linje.someRenderingCheck}">
        <f:facet name="header">
            <h:outputText value="Status"/>
        </f:facet>
        <h:outputText value="#{linje.someText}"/>
</rich:column>
1

There are 1 answers

1
Konstantin Yovkov On

You can pass the variable linje as a parameter for the <ui:unclude>.

For example:

<ui:include src="someColumn.xhtml">
    <ui:param name="linje" value="#{linje}" />
</ui:include>

It will be a request parameter for someColumn.xhtml and you can copy it to another one (using the <c:set> tag), in order to avoid IDE warnings:

<c:set var="linje" value="#{linje}" />