You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by René Zanner <re...@accelsis.biz> on 2006/07/28 12:40:08 UTC

Easier way to exclude content from the HTML template?

Hi all,

one question just came to my mind... When using HTML templates in conjunction with view composition, I want to use HTML templates from my HTML designers and exclude all the redundant stuff. Only the portion of the page containing my body content (or footer panel or whatever) should be added to the component tree. Today I have to add a jsfid="void" to EACH of the HTML tags of the original HTML template to exclude it from the component tree. To exclude whiole blocks there is the possiblity o use jsfid="void" plus allowBody="false", but this only works, if there's no real jsf component nested.

I'm thinking of something different - maybe some special HTML comment as marker to exclude/include portions of the template:

<!-- ### clay:remove ### -->
<html ....
   this is the basic layout to be removed when converting to an include
...

<div class="content">
<!-- ### /clay:remove ### -->
<!-- 
    this is the body content to be placed 
    in the basic layout HTML template defined elsewhere 
-->
   <form>
      <input type="text" value="#{contentBean.inputText}"/>
      <input type="submit" action="#{contentBean.doSubmit}"/>
   </form>
<!-- ### clay:remove ### -->
</div>

   this is the basic layout to be removed when converting to an include
...
</html>
<!-- ### /clay:remove ### -->


In Facelets' HTML templates this is done in a reverse fashion. Everthing outside special HTML-Tags is removed from the resulting component subtree:

<html xmlns:ui="some facelets uri" ...>
   this is the basic layout to be removed when converting to an include
...

<div class="content">

<ui:composite ...>
<!-- everything outside this tag is stripped -->
   <form jsfc="h:form">
      <input jsfc="h:inputText" type="text" value="#{contentBean.inputText}"/>
      <input jsfc="h:commandButton" type="submit" action="#{contentBean.doSubmit}"/>
   </form>
</ui:composite>

</div>

   this is the basic layout to be removed when converting to an include
...
</html>

What do you think? Is this more a topic for the developer list?

Cheers,

René

Re: Easier way to exclude content from the HTML template?

Posted by Mike Kienenberger <mk...@gmail.com>.
On 7/28/06, René Zanner <re...@accelsis.biz> wrote:

> In Facelets' HTML templates this is done in a reverse fashion. Everthing outside special HTML-Tags is removed from the resulting component subtree:

Facelets also has a <ui:remove> tag, but this only works if the
internal parts are xml-balanced, although I suppose you might be able
to use CDATA with that to comment things out.