Discussion:
JSF 'Unknown Property'
RayDeCampo
2014-10-09 20:59:53 UTC
Permalink
I have a project I am migrating from IntelliJ. In IntelliJ I could use an @elvariable comment to tell the IDE about the type of EL variables it could not determine itself. E.g.

Code:

<!--@elvariable id="plan" type="com.example.model.Plan"-->
<t:dataTable id="planTable" var="plan" forceIdIndexFormula="#{plan.id}"
value="#{plansDataModel}" rowStyleClass="row style#{plan.status}" renderedIfEmpty="false">
<h:column>
<h:outputText value="#{plan.planNumber}"/>
</h:column>
</t:dataTable>




Here the IDE cannot determine the type of the variable plan in the dataTable. NetBeans warns me with 'Unknown Property' on every use of the plan variable. However, IntelliJ is able to determine that the properties are correct because it interprets the @elvariable comment and knows that the type is com.example.model.Plan.

Is there an equivalent to this for NetBeans? I am using NetBeans 8.0.1.
Antonio Varela
2014-10-10 15:39:54 UTC
Permalink
I'm not aware of an equivalent for that, but shouldn't be a problem
determining the data type of the value. How or where is declared the
"plansDataModel" bean? Are you using CDI or JSF bean annontations?
Post by RayDeCampo
I have a project I am migrating from IntelliJ. In IntelliJ I could use an
@elvariable comment to tell the IDE about the type of EL variables it could
not determine itself. E.g.
<t:dataTable id="planTable" var="plan" forceIdIndexFormula="#{plan.id}"
value="#{plansDataModel}" rowStyleClass="row
style#{plan.status}" renderedIfEmpty="false">
<h:column>
<h:outputText value="#{plan.planNumber}"/>
</h:column>
</t:dataTable>
Here the IDE cannot determine the type of the variable plan in the
dataTable. NetBeans warns me with 'Unknown Property' on every use of the
plan variable. However, IntelliJ is able to determine that the properties
the type is com.example.model.Plan.
Is there an equivalent to this for NetBeans? I am using NetBeans 8.0.1.
--
Antonio Varela
unixlibre-***@public.gmane.org
RayDeCampo
2014-10-10 16:49:28 UTC
Permalink
I'm not aware of an equivalent for that, but shouldn't be a problem determining the data type of the value. How or where is declared the "plansDataModel" bean? Are you using CDI or JSF bean annontations?
Neither, it's defined in a faces-config.xml file. It's a custom implementation of javax.faces.model.DataModel.


Code:

<managed-bean>
<managed-bean-name>plansDataModel</managed-bean-name>
<managed-bean-class>com.example.faces.PaginatedResultsDataModel</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>wrappedData</property-name>
<property-class>java.lang.Object</property-class>
<value>#{plansPaginatedResults}</value>
</managed-property>
<managed-property>
<property-name>loader</property-name>
<property-class>com.example.utils.PaginatedResultsLoader</property-class>
<value>#{plansLoader}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>plansPaginatedResults</managed-bean-name>
<managed-bean-class>com.example.utils.PaginatedResults</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>




The PaginatedResultsDataModel class itself is generic:


Code:

public class PaginatedResultsDataModel<T> extends DataModel<T>




I'm not sure how NetBeans would be able to discern the type of things in the data model in this scenario.
Loading...