1

After reading this answer, I am still stumped. I agree that JSTL should be avoided and understand how its evaluation occurs in the wrong phase. However, per the documentation on the facelets development site, it appears that <ui:fragment> tags only supports two attributes, id and binding. So, even if some implementation support rendered, it seems like you would be tempting fate to make use of it. The other suggestion was to use <h:panelGroup>, however, that inserts a <div> element in the response which could cause undesirable side effects (like changing your content from inline to block). Does anyone know a way around this? In particular, I am attempting the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns:ice="http://www.icesoft.com/icefaces/component" 
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:ui="http://java.sun.com/jsf/facelets">
  <ui:composition> 
    <ice:selectOneListbox binding="#{binding}" rendered="#{modeExisting}">
      <f:selectItems
        value="#{binding.allTagsSelectItems}" />
    </ice:selectOneListbox>
    <ice:inputText binding="#{binding.name}" />
    <ice:inputText binding="#{binding.description}" />
  </ui:composition> 
</html>

Which is basically a listbox used to select an element with a name and description which when selected will allow the user to edit them. I could put an <ice:panelGroup> around the block, and use the rendered attribute of it, but again, there could be side effects of injecting that additional div. Is there any way to make this work?

Also, it may be worth mentioning that I am using the above custom component paired with this facelet-taglib:

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC 
"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" 
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd"> 

<facelet-taglib>
  <namespace>http://www.mitre.org/asias/jsf</namespace>
  <tag>
    <tag-name>configurationTagEditor</tag-name>
    <source>../component/configurationTagEditor.xhtml</source>
  </tag>
  <tag>
    <tag-name>configurationTagSelector</tag-name>
    <source>../component/configurationTagSelector.xhtml</source>
  </tag>
  <tag>
    <tag-name>configurationTagRegexTable</tag-name>
    <source>../component/configurationTagRegexTable.xhtml</source>
  </tag>
</facelet-taglib>

To allow me to use this in my jsf xhtml:

...
<ice:panelTab label="Existing" styleClass="configurationTagsExisting">
  <m:configurationTagEditor tag="#{configuration.existingTag}" />
</ice:panelTab>
...
Community
  • 1
  • 1
Lucas
  • 14,227
  • 9
  • 74
  • 124

1 Answers1

0

The other suggestion was to use <h:panelGroup>, however, that inserts a <div> element in the response

The <h:panelGroup> doesn't render a <div> by default. It only renders that if you add layout="block". For all other HTML attributes (like id, styleClass, etc), it only renders a <span>. If no layout attribute is present and all other HTML attributes are absent, it renders nothing.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thank you, I was unaware. My reference material was that of Icefaces rather than JSF directly and the icefaces documentation for the corresponding panelGroup element says: "The panelGroup component renders a "div" element around it's child components, outputting the value of the "style" attribute as the value of the "style" attribute, and the value of the "styleClass" attribute as the value of the "class" attribute." Again, thank you, I will use the JSF panelGroup for this purpose. – Lucas Dec 03 '10 at 18:59
  • That's the description of `ice:panelGroup`, not `h:panelGroup`. Check here: http://download.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/index.html – BalusC Dec 03 '10 at 19:01