Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

381
Visualizações
How to render React component inside JSF using javascript chunks?

I have interesting case where I have to put React component inside JSF part of business application. I tried to achieve that with <h:outputScipt> but without success.

I imported chunks from react component and put them like here:

enter image description here

Then I used <h:outputScript/> like this:

<ui:composition template="/templates/tempMain.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui">

    <ui:define name="content">
        <h:form id="AdditionalServiceTemplatesForm">
            <p:panel id="additionalServiceTemplatesPanel">
                <div id="ComponentName" style="background-color: white" class="container"></div>
                    <h:outputScript library="js" name="19.649a5d09.chunk.js"/>
                    <h:outputScript library="js" name="runtime-main.d6107f88.js"/>
                    <h:outputScript library="js" name="main.d73a6ff5.chunk.js"/>
                    <h:outputScript library="js" name="hello.js"/>
                <h:form>
                    <h:commandButton onclick = "showMessage();" />
                </h:form>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>

Normal javascript script hello.js (not chunk) is visible and is working but react component from chunks is not rendered. All I've got is empty jsf container.

Additionaly there is information in the console: enter image description here

Additionaly I tried to change relative paths in chunks from static/js to "resources/js" and "javax.faces.resource/js" and without any path. Nothing is working.

After compilation, sources looks like this:

enter image description here

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda