TheCoder4eu / BootsFaces-OSP

BootsFaces - Open Source Project
Apache License 2.0
247 stars 102 forks source link

Warning when passing a value in a custom facelets tag #1159

Closed Piotr-K8i closed 3 years ago

Piotr-K8i commented 3 years ago

In the component I created for the transferred value "value" I get the following warning: WARNING [https-jsse-nio-8081-exec-5] net.bootsfaces.beans.ELTools.evaluteBaseForMojarra There's no getter to access: #{/WEB-INF/facelets/tags/bootsfacesSelectMenu.xhtml @11,116 value="#{value}"}

An example of my component:

<!DOCTYPE html>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:b="http://bootsfaces.net/ui"
                xmlns:adm="http://www.company.com/global/services/software/interstage">

  <adm:panelGrid>
    <adm:outputLabel value="#{label}"/>
    <h:panelGroup>
      <b:selectOneMenu select2="true" styleClass="select" id="#{id}" onchange="#{onchange}" onclick="#{onclick}"
                          immediate="#{immediate}" oncomplete="#{oncomplete}" value="#{value}" disabled="#{disabled}">
        <ui:insert/>
      </b:selectOneMenu>
    </h:panelGroup>
  </adm:panelGrid>
</ui:composition>

An example of calling a component:

<adm:bootsfacesSelectMenu   id="serviceId" onchange="BootsFacesUtils.changeSelectionIndexAtDropDown(this);"
                                value="#{serviceBean.selectedService}" label="#{msg['service.serviceId']}">
     <f:selectItem itemLabel="#{msg['common.pleaseSelect']}" itemValue="#{itemValue}" />
     <c:forEach items="#{serviceBean.availableServices}" var="service">
          <f:selectItem itemLabel="#{service.serviceId}" itemValue="#{service.key}" />
     </c:forEach>
</adm:bootsfacesSelectMenu>

Everything works as it should except the warning messages appearing in the console

geopossachs commented 3 years ago

Hallo @KabacinskiPiotr, I use "ui:composition" only for the layout templating of my pages. To define a component I use composite components like this example https://mkyong.com/jsf2/composite-components-in-jsf-2-0/

Will be to use composite components as an alternative for you?

geopossachs commented 3 years ago

If you like you can also take a look into the opportunities of f:selectItems It wants to help you to do without c:forEach https://mkyong.com/jsf2/jsf-2-dropdown-box-example/

Piotr-K8i commented 3 years ago

Thanks for your help, it was resolved