Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF EL comparison

843844Jan 21 2010 — edited Jan 21 2010
Hello,
I want to compare two vales. One of them is a GET parameter and the other is an attribute of an iterator.
The JSF EL comparison is:
<c:if test="#{param.product_selected_id == current_product.id}">
This doesn't work even when the two values are the same.
If I change the code to debug and analyze what is happening:
<c:if test="#{products_controller.compare(param.product_selected_id, current_product.id)}">
In the Managed Bean function I logged the parameters and "current_product.id" is always "0". I tried to use String, Integer and int types for the function parameter.
I am sure "current_product.id" should work fine because in the JSF page I have:
<h:outputLink value="list_products.xhtml?product_selected_id=#{current_product.id}">
        <h:outputText  styleClass="numeric" value="#{current_product.name}"/>
</h:outputLink>
I clearly see that the generated html page has links to "list_products.xhtml" with the correct "current_product.id" value which is different to 0 and changes for each row.

I use the dataTable tag to generate the current_product variable:
<h:dataTable value="#{products_controller.products}" var="current_product">
Edited by: Pau_carre on Jan 21, 2010 1:18 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2010
Added on Jan 21 2010
1 comment
187 views