1

I have set up a very simple example to check out the BootsFaces JSF library. The b:commandButton from BootsFaces is raising an exception while h:commandButton from the native JSF component does not. I have no clue why.

This is the xhtml that I am using for the test:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:b="http://bootsfaces.net/ui">

<h:head></h:head>
    <h:body>
        <h:form id="options">
            <h:inputText label="input" title="input" value="#{testBean.message}" />
            <div>
                <h:commandButton value="this works" action="#{testBean.submit}">
                    <f:ajax execute="@form" render="@all" />
                </h:commandButton>
                <b:commandButton value="this does not work"
                                    ajax="true"
                                    action="#{testBean.submit}"
                                    process="@form" update="@all" />
            </div>
            <div><h:outputText value="#{testBean.message}" /></div>
        </h:form>
    </h:body>
</html>

The backing bean looks like this:

@Named("testBean")
@RequestScoped
public class TestBean {

    private String msg = null;

    public void setMessage(final String msg) {
        this.msg = msg;
    }

    public String getMessage() {
        return msg;
    }

    public void submit() {
        //do some business logic here
    }
}

If I click the 1st button on the web page ("this works") then everything behaves like expected. If I click on the 2nd button of the web page ("this does not work") then the following exception is raised:

2019-08-30 18:18:52,711 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-2) Error Rendering View[/test.xhtml]: java.lang.IllegalStateException: CDATA tags may not nest
        at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.startCDATA(HtmlResponseWriter.java:714)
        at javax.faces.context.ResponseWriterWrapper.startCDATA(ResponseWriterWrapper.java:201)
        at javax.faces.context.PartialResponseWriter.startUpdate(PartialResponseWriter.java:221)
        at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:637)
        at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1736)
        at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:424)
        at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:343)
        at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1124)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1905)
        at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:639)
        at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1736)
        at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:424)
        at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:343)
        at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1124)
        at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1905)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:465)
        at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:194)
        at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
        at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
        at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:151)
        at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:126)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
        at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:223)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:671)
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
        at io.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:55)
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
        at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
        at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
        at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
        at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
        at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
        at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
        at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
        at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1502)
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
        at java.lang.Thread.run(Thread.java:748)

This is the software that I am using for the test: Wildfly 14.0.1, JSF 2.3.5 SP2 (Mojarra) and BootsFaces 1.4.1

Does anyone know why the button from BootsFaces raises this exception?

trane
  • 27
  • 1
  • 8
  • What if you don't do an `update='@all'`? It is not a common usage. But e.g update the form or even less? – Kukeltje Aug 31 '19 at 10:13
  • Hi Kukeltje, if I replace ```update='@all'``` with ```update='@form'``` the Bootsfaces button works. I agree with you that updating the entire page when using ajax does not really make sense. But I assume that technically the command button from Bootsfaces should be able to handle ```update='@all'```. – trane Aug 31 '19 at 13:29
  • Primefaces (on which the core of bootsfaces was originally based iirc) has had a problem with `@all` too. So yes, it should, but it is human work, so errors are made (aka bugs ;-)) – Kukeltje Aug 31 '19 at 17:03
  • When I joined the BootsFaces team in 2014, the BootsFaces architecture didn't resemble the PrimeFaces architecture. In fact, I'm pretty sure it's independant work from day one (but I'll ask, it's a good question). As far as I remember, it was me who implemented `@all`. – Stephan Rauh Sep 01 '19 at 10:15
  • The bug also happens with Liberty 18 and BootsFaces 1.4.2. – Stephan Rauh Sep 01 '19 at 10:25
  • @Stephan Thanks for your input. Well, you can use other ways to update the page so it's not really a big deal. But If you want I can open an issue on GitHub. – trane Sep 01 '19 at 10:33
  • @trane Yes, opening a ticket would be nice. I've spent an hour debugging the bug. It seems everything is rendered twice - but I can't find out the reason. BootsFaces isn't even part of the stacktrace, so it's a bit difficult to find out what's going on. – Stephan Rauh Sep 01 '19 at 11:49
  • For everyone who might want to follow-up on this topic:[issue on github](https://github.com/TheCoder4eu/BootsFaces-OSP/issues/1094) – trane Sep 03 '19 at 16:43

0 Answers0