3

i'm having a very strange behaviour with this piece of code:

<ui:fragment rendered="#{price.guestIdTrue}">
<b>PRICE_GUEST_ID_TRUE : #{price.guestIdTrue}</b>
    <h:outputText>#{Global.guestTypeMap[price.guestId]}&#160;#{price.guestIndex}</h:outputText>
</ui:fragment>

Even when the rendered condition is false, the

PRICE_GUEST_ID_TRUE : false 1

1 is the #{price.guestIndex}

The ui namespace is correctly defined, and it works on others facelets.

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:t="http://myfaces.apache.org/tomahawk">

Any Ideas of what happens.

Thanks in advance.

TinGinard
  • 377
  • 1
  • 3
  • 9

1 Answers1

6

You seem to be using <ui:fragment> inside an iterating tag/component where the #{price} is actually the currently iterated variable, such as the JSTL <c:forEach> tag, or the JSF <h:dataTable> or <ui:repeat> component while using an early version of Mojarra. In those situations, the #{price} is not available in EL scope at the point it's been evaluated.

You need the <h:panelGroup rendered> instead or to upgrade the Mojarra version to the latest.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Hi Balus. I've just change the – TinGinard Jan 02 '12 at 18:08
  • You're welcome. This problematic combination is actually new to me. It sounds like a (partial) state saving bug in Tomahawk. What version were you using? It's currently at 1.1.11, the only other one being 1.1.10. – BalusC Jan 02 '12 at 18:10
  • Please note that `` does **not** render any HTML markup if you do **not** use any HTML-specific attributes such as `id`, `styleClass`, etc, if that was the sole reason to use `` instead. The `` ought to work fine together with ``. – BalusC Jan 02 '12 at 18:12
  • I'm using myfaces 2.1.4 with tomahawk20-1.1.11.jar and i think i'm going to drop tomahawk. – TinGinard Jan 02 '12 at 18:13
  • Oh, in MyFaces the `` doesn't have the same bugs as in Mojarra. It's definitely a better choice than `` if you don't intend to render any `
      ` markup. But still, this combination introduces a new possibility that the bug is actually in MyFaces' `` itself, perhaps the same bug as in early versions of Mojarra.
    – BalusC Jan 02 '12 at 18:16
  • 1
    I checked this problem and in MyFaces there was some issues related to (MYFACES-3239 and MYFACES-3146), which where solved in 2.1.2, but tomahawk 1.1.11 has some shared code and the latest version in that time was 2.1.1, so 1.1.11 has the bug but it will be solved on the next release. – lu4242 Jan 30 '12 at 17:02