[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-06-05 Thread Werner Punz (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852460#comment-17852460
 ] 

Werner Punz commented on MYFACES-4669:
--

Yes Either the spec needs to change and we have to adapt or Mojarra needs to 
fix it, lets wait for the result!

Btw. thanks for digging around, you saved me a few hours of work!

 

> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-06-05 Thread Volodymyr Siedlecki (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852458#comment-17852458
 ] 

Volodymyr Siedlecki commented on MYFACES-4669:
--

There is a workaround thankfully. I hope Arjan might be able to comment in the 
spec issue – it would be nice to have this behavior consistent.

> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-06-04 Thread Werner Punz (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852188#comment-17852188
 ] 

Werner Punz commented on MYFACES-4669:
--

I I just checked the comments on this one, wanted to take over it on thursday, 
if it is a mojarra bug then yes it needs to be filed on the mojarra side not on 
the myfaces side. MyFaces seems to follow the spec here, Mojarra not!

 

> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Assignee: Werner Punz
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-06-04 Thread Melloware (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852185#comment-17852185
 ] 

Melloware commented on MYFACES-4669:


OK its a Mojarra bug should we close this Myfaces bug?

> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Assignee: Werner Punz
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-06-04 Thread Volodymyr Siedlecki (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17852172#comment-17852172
 ] 

Volodymyr Siedlecki commented on MYFACES-4669:
--

I reported a similar problem here: 
[https://github.com/jakartaee/faces/issues/1796]

MyFaces will need to escape the XML.  I think this is a spec bug.

> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Assignee: Werner Punz
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-05-30 Thread Melloware (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850692#comment-17850692
 ] 

Melloware commented on MYFACES-4669:


What it seems to come down to is this.


{code:java}
var htmlTag = new UIOutput();
htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
rootChildren.add(htmlTag);
{code}

MyFaces escapes that but Mojarra just renders it exactly to browser.  I don't 
know what the Faces spec says about this


> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Assignee: Werner Punz
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-05-29 Thread Melloware (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850384#comment-17850384
 ] 

Melloware commented on MYFACES-4669:


OK part of the issue I fixed the DOCTYPE by changing to this...


{code:java}
var htmlDoctype = new HtmlDoctype();
htmlDoctype.setRootElement("html");
rootChildren.add(htmlDoctype);
{code}

BUt I still don't see any way to add an "html" tag element that isn't escaped?


> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Assignee: Werner Punz
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MYFACES-4669) Programmatic Facelet Not Rendering Correctly

2024-05-28 Thread Werner Punz (Jira)


[ 
https://issues.apache.org/jira/browse/MYFACES-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850259#comment-17850259
 ] 

Werner Punz commented on MYFACES-4669:
--

I will have a look the next few days, lets see what I can find out!

 

> Programmatic Facelet Not Rendering Correctly
> 
>
> Key: MYFACES-4669
> URL: https://issues.apache.org/jira/browse/MYFACES-4669
> Project: MyFaces Core
>  Issue Type: Bug
>  Components: General
>Affects Versions: 4.0.2, 5.0.0, 4.1.0-RC3
>Reporter: Melloware
>Assignee: Werner Punz
>Priority: Major
> Attachments: image-2024-05-28-17-42-16-539.png, 
> image-2024-05-28-17-43-37-052.png, programmatic_view.zip
>
>
> Attached is an example:
> Run 
> {code:java}
> mvn clean jetty:run -Pmojarra40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders correctly.
> !image-2024-05-28-17-42-16-539.png!
>  
> Run 
> {code:java}
> mvn clean jetty:run -Pmyfaces40{code}
>  and navigate to [http://localhost:8080/facelet.xhtml] you will see the 
> programmatic view renders incorrectly with ESCAPED HTML tags.  [~werpu] this 
> looks like more double escaping for XML?
> !image-2024-05-28-17-43-37-052.png!
> {code:java}
> package org.apache.myfaces.core.extensions.quarkus.showcase.view;
> import jakarta.enterprise.context.ApplicationScoped;
> import jakarta.faces.annotation.View;
> import jakarta.faces.application.StateManager;
> import jakarta.faces.component.UIComponent;
> import jakarta.faces.component.UIOutput;
> import jakarta.faces.component.html.HtmlBody;
> import jakarta.faces.component.html.HtmlCommandButton;
> import jakarta.faces.component.html.HtmlForm;
> import jakarta.faces.component.html.HtmlOutputText;
> import jakarta.faces.context.FacesContext;
> import jakarta.faces.view.facelets.Facelet;
> @View("/facelet.xhtml")
> @ApplicationScoped
> public class FaceletView extends Facelet
> {
> @Override
> public void apply(FacesContext facesContext, UIComponent parent)
> {
> if 
> (!facesContext.getAttributes().containsKey(StateManager.IS_BUILDING_INITIAL_STATE))
> {
> return;
> }
> var components = new ComponentBuilder(facesContext);
> var rootChildren = parent.getChildren();
> var doctype = new UIOutput();
> doctype.setValue("");
> rootChildren.add(doctype);
> var htmlTag = new UIOutput();
> htmlTag.setValue("http://www.w3.org/1999/xhtml\";>");
> rootChildren.add(htmlTag);
> HtmlBody body = components.create(HtmlBody.COMPONENT_TYPE);
> rootChildren.add(body);
> HtmlForm form = components.create(HtmlForm.COMPONENT_TYPE);
> form.setId("form");
> body.getChildren().add(form);
> HtmlOutputText message = 
> components.create(HtmlOutputText.COMPONENT_TYPE);
> message.setId("message");
> HtmlCommandButton actionButton = 
> components.create(HtmlCommandButton.COMPONENT_TYPE);
> actionButton.setId("button");
> actionButton.addActionListener(
> e -> message.setValue("Hello, World! Welcome to Faces 4.0 on 
> Jakarta EE 10"));
> actionButton.setValue("Greet");
> form.getChildren().add(actionButton);
> parent.getChildren().add(message);
> htmlTag = new UIOutput();
> htmlTag.setValue("");
> rootChildren.add(htmlTag);
> }
> private static class ComponentBuilder
> {
> FacesContext facesContext;
> ComponentBuilder(FacesContext facesContext)
> {
> this.facesContext = facesContext;
> }
> @SuppressWarnings("unchecked")
>  T create(String componentType)
> {
> try
> {
> return (T) 
> facesContext.getApplication().createComponent(componentType);
> }
> catch (ClassCastException e)
> {
> throw new IllegalArgumentException("Component type " + 
> componentType + " is not valid.", e);
> }
> }
> }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)