jakartaee / jakartaee/faces

Add ability for define tag to append to an existing definition

Open
#1,008 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Facelets/VDL Priority: Minor Type: New Feature
Dominant language
Java
Stars
127
Forks
59
Avg merge
23h
Merged PRs (30d)
7

Description

In Facelets one can use a ui:define tag to define content in a template client. This named content can be inserted into a template by using ui:insert.

When the template client that defines the content is itself a template, its template client may also want to contribute to this content, typically by appending to it. This is currently not possible. The template needs to use a new ui:insert tag with a new name.

E.g.

template.xml

<f:view>            
    <ui:insert name="links"/>        
</f:view>

general.xml

<ui:composition template="template.xhtml">     
   <ui:define name="links">
         <h:link ... />
         <ui:insert name="links1"/>    
   </ui:define>        
 </ui:composition>

orders.xml

<ui:composition template="general.xhtml">     
   <ui:define name="links1">
      <h:link ... />
      <ui:insert name="links2"/>     
   </ui:define>        
 </ui:composition>

etc

Instead of manually 'chaining' defines and inserts in this way, Facelets could define tags or attributes for contributing to existing definitions. E.g.:

general.xml

<ui:composition template="template.xhtml">     
   <ui:append name="links">
      <h:link ... />    
   </ui:append>        
 </ui:composition>

orders.xml

<ui:composition template="general.xhtml">     
   <ui:append name="links">
      <h:link ... />    
   </ui:append>        
 </ui:composition>

Instead of introducing a new ui:append tag, a contribute="append" on ui:define could be used instead. Next to appending, prepending could be considered via a ui:contribute tag or contribute="prepend" attribute.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files or tests. Start by tracing existing ui:define and ui:insert handling in Facelets, then settle whether ui:append or a contribute attribute is the intended API. Done means nested templates can append to an existing definition without manual chaining.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.