0
ParentPage.xhtml 
                <p:tab id="games"    title="Games">
                <ui:include src="/jsf/sections/general.xhtml" />

                <ui:fragment rendered="#{javaMB.pageTypeId eq 1}">
                    <ui:include src="/jsf/sections/oldGames.xhtml" />
                </ui:fragment>

                  <ui:fragment rendered="#{javaMB.pageTypeId eq 2}">
                    <ui:include src="/jsf/sections/presentGames.xhtml" />
                </ui:fragment>

                  <ui:fragment rendered="#{javaMB.pageTypeId eq 3}">
                    <ui:include src="/jsf/sections/newGames.xhtml" />
                </ui:fragment>  

                    <ui:include src="/jsf/sections/select.xhtml" />
                    <ui:include src="/jsf/sections/submit.xhtml" />
                </p:tab>

In the select.xhtml we have the drop down menu

    <p:selectOneMenu id="console" value="#{selectOneMenuView.console}" style="width:125px">
        <f:selectItem itemLabel="Select One" itemValue="" />
        <f:selectItem itemLabel="Xbox One" itemValue="Xbox One" />
        <f:selectItem itemLabel="PS4" itemValue="PS4" />
        <f:selectItem itemLabel="Wii U" itemValue="Wii U" />
    </p:selectOneMenu>
                -------------

The form submission works fine and the pageType s are causing no Issues.

                        String gametp = params.get("pagetype");

                        http://localhost:7001/game/jsf/filing/ParentPage.xhtml?pagetype=1

Now I have modified the selectOneMenu as per few conditions and introduced the following

Newly added/modified code in select.xhtml

 xmlns:c="http://java.sun.com/jsp/jstl/core"

    <p:selectOneMenu id="console" value="#{selectOneMenuView.console}" style="width:125px">
        <f:selectItem itemLabel="Select One" itemValue="" />
                <c:if test="${javaMB.pageTypeId eq 1}">
                    <f:selectItem itemLabel="Xbox One" itemValue="Xbox One" />                                              
                </c:if>             
                <c:if test="${javaMB.pageTypeId eq 2}">
                    <f:selectItem itemLabel="PS4" itemValue="PS4" />
                    <f:selectItem itemLabel="Sega" itemValue="Sega" />                          
                </c:if>
                <c:if test="${javaMB.pageTypeId eq 3}">
                    <f:selectItem itemLabel="Wii" itemValue="Wii" />                                                
                </c:if>
    </p:selectOneMenu>              

Accessed the page

http://localhost:7001/game/jsf/filing/ParentPage.xhtml?pagetype=1

and tried to select a radiobutton which is in general.xhtml

<h:selectOneRadio value="#{bean.choice}">
<f:selectItem itemValue="yes" itemLabel="YES" />
<f:selectItem itemValue="no" itemLabel="NO" />
<f:ajax render="calendar" />
</h:selectOneRadio>

<p:calendar id="calendar" value="#{bean.date}" disabled="#{bean.choice eq 'no'}" />

Error

 javax.faces.view.facelets.TagAttributeException: /jsf/sections/select.xhtml @29,69 test="#{javaMB.pageTypeId eq 1}" An error occurred performing resource injection on managed bean javaMB

Scrolled to the bottom of the console , I found this too

 Caused by: java.lang.NullPointerException  
                        at javaMB  LINE                 if (gametp
                        at javaMB  LINE init    -    this.setFormEntity(this.newForm(gametp));

Turns out gametp which is the page type is getting a null,

Before the addition of these --

<c:if tags

-- It worked well,

This has effected various other components as well such as the radio button etc Tried one other component - doing a file upload threw the same error,

Any resolution for this? Thanks

lena
  • 5
  • 4

0 Answers0