jsf - Specify conditional rendering of element inside ? The does not seem to work -


I & lt; Ui: repeat & gt; I'm trying to conditionally consolidate the custom list using . On every incident of -1 as item-value in the list, I need to add a line break.

I joined & lt; C: if & gt; Tried to use inside & lt; Ui: Repeat; Gt; For this, but it does not seem to work, it always evaluates false .

  & lt; Ul & gt; & Lt; Ui: Repeated value = "# {subjects.list}" var = "topicId" & gt; & Lt; Li & gt; # {TopicId} & lt; / Li & gt; & Lt; C: If test = "# {topicId eq -1}"> & Lt; Br / & gt; & Lt; / C: If & gt; & Lt; / Ui: Repeat & gt; & Lt; / Ul & gt;   

Is this possible?

Not with JSTL tags, no. They run during view build times, not during the scene render time. You can see it this way, when JSF creates the view, the JSTL tag first runs down and the result is the pure JSF component tree. Then when JSF renders the scene, the JSF component moves from top to bottom and the result is a bunch of HTML. Therefore, JSTL and JSF do not run in sync because you expect coding. At the moment your & lt; C: if & gt; , then the # {topicId} is not available in the scope.

& lt; C: if & gt; , you need to specify the position in the provided attribute of the JSF component of interest. As you do not really have any, you can wrap it in one.

  & lt; Ul & gt; & Lt; Ui: Repeated value = "# {subjects.list}" var = "topicId" & gt; & Lt; Li & gt; # {TopicId} & lt; / Li & gt; & Lt; Ui: section provided = "# {subjectId eq -1}" & gt; & Lt; Br / & gt; & Lt; / UI: section & gt; & Lt; / Ui: Repeat & gt; & Lt; / Ul & gt;   

Optional

  & lt; H: Panel Group is provided = "# {topicId eq -1}" & gt; ; & Lt; Br / & gt; & Lt; / H: panelGroup & gt;   

or in your specific case

  & lt; H: output text value = "& amp; lt; br / & gt;" escape = "false" provided = "# {topicId eq -1}" />   

Whenever a client side attribute is not specified, there is nothing left for both the HTML output as a result.

See also:

  • Unrelated With the problem of concrete, Em> incorrect a & gt; . This will be ignored by any webbrover that respects the HTML specification. Does not mean that inside & lt; Li & gt; ? Or better, give it class and CSS give it the margin-bottom .

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -