-2
  1. This is my HTML FILE

     <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:p="http://primefaces.org/ui"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core">
    
        <ui:composition>
    
            <h:form id="UserTagsForm" >
    
                <h:panelGrid id="pgrid" columns="1" cellpadding="5" cellspacing="5" style="margin: 0 auto;margin-top: 25px" >
    
                    <p:outputLabel value="Select ChipId of pod" for="chipIdList" />
                    <p:selectOneMenu id="chipIdList" value="#{usertagsController.selected.chipId}" required="true" requiredMessage="Chip Id required" converter="podConverter" >
                        <f:selectItem itemLabel="#{messages.SelectOneMessage} " />
                        <f:selectItems value="#{podController.items}"
                                       var="chipidItems"
                                       itemValue="#{chipidItems}"
                                       itemLabel="#{chipidItems.chipId.toString()}"/>
                    </p:selectOneMenu>
    
                    <p:outputLabel value="Select Event Type" for="eventTypeList" />
                    <p:selectOneMenu id="eventTypeList" value="#{usertagsController.selected.eventType}" required="true" requiredMessage="Event Type List required" converter="usertagseventnamesConverter" >
                        <f:selectItem itemLabel="#{messages.SelectOneMessage} " />
                        <f:selectItems value="#{usertagseventnamesController.items}"
                                       var="eventItems"
                                       itemValue="#{eventItems}"
                                       itemLabel="#{eventItems.eventDesc.toString()}"/>
                    </p:selectOneMenu>
    
                    <p:outputLabel for="datetime" value="Choose Datetime:" />
                    <p:calendar id="datetime" value="#{usertagsController.selected.dateTime}" pattern="MM/dd/yyyy HH:mm:ss" required="true" requiredMessage="Date time required"/>
    
    
                    <f:facet name="footer">    
                        <p:commandButton value="Save" id="saveBtn" actionListener="#{usertagsController.saveNew}" icon="ui-icon-disk" />
                    </f:facet> 
                    <p:blockUI block="pgrid" trigger="saveBtn"  />
                </h:panelGrid>
    
               <ui:include src="/confirmation.xhtml"/>
            </h:form>
        </ui:composition>
    </html>        
    

2.This is my BeanController.

    @ManagedBean
    @ViewScoped
    public class UsertagsController extends AbstractController<UserTags> implements java.io.Serializable{

        private static final long serialVersionUID = -4377337774610224471L;

        @ManagedProperty("#{podController}")
        private PodController podController ;

        @ManagedProperty("#{usertagseventnamesController}")
        private UsertagseventnamesController usertagseventnamesController;

        public UsertagsController() {
            super(UserTags.class);
            columnNames();
            columnList();

        } 

        public PodController getPodController() {
            return podController;
        }

        public void setPodController(PodController podController) {
            this.podController = podController;
        }

        public UsertagseventnamesController getUsertagseventnamesController() {
            return usertagseventnamesController;
        }

        public void setUsertagseventnamesController(UsertagseventnamesController usertagseventnamesController) {
            this.usertagseventnamesController = usertagseventnamesController;
        }

       @Override
        public void saveNew(ActionEvent event) {
            super.saveNew(event);
        }

        @Override
        public void resetParents() {

            podController.setSelected(null);
            usertagseventnamesController.setSelected(null);

        }
    }
  1. This is class that I extend AbstractController:

    public class AbstractController<T> {
        protected IGenericDAO<T> dao;
        protected IColumnSettings columnsDAO = new ColumnSettingsDAOImpl();
    
        private T selected;
        private List<T> filtered;
        private Class<T> itemClass;
        private Collection<T> items;
    
        private enum PersistAction {
            CREATE,
            DELETE,
            UPDATE
        }
    
        public AbstractController(Class<T> itemClass) {
            //super(itemClass);
            dao = new GenericDAOImpl<T>(itemClass);
            this.itemClass = itemClass;
            listVisible = new ArrayList<Boolean>();
            listWidth = new ArrayList<>();
            //columnList();
        }
    
        public T getSelected() {
            return selected;
        }
    
        public void setSelected(T selected) {
            this.selected = selected;
        }
    
    
        public List<T> getFiltered() {
            return filtered;
        }
    
        public void setFiltered(List<T> filtered) {
            this.filtered = filtered;
        }
    
    
        public Class<T> getItemClass() {
            return itemClass;
        }
    
        public void save(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/messages").getString(itemClass.getSimpleName() + "Updated");
            persist(PersistAction.UPDATE, msg);
            if (!isValidationFailed()) {
                selected = null;
            }
        }
    
        public void saveNew(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/messages").getString(itemClass.getSimpleName() + "Created");
            persist(PersistAction.CREATE, msg);
    
            if (!isValidationFailed()) {
                selected = null;
            }
        }
    
        public void delete(ActionEvent event) {
            String msg = ResourceBundle.getBundle("/messages").getString(itemClass.getSimpleName() + "Deleted");
            persist(PersistAction.DELETE, msg);
            if (!isValidationFailed()) {
                selected = null; // Remove selection
            }
        }
    } 
    
  2. This is Exception result:

    javax.el.PropertyNotFoundException: /patient_blankPage.xhtml @16,173 value="#{usertagsController.selected.chipId}": Target Unreachable, 'null' returned null
            at javax.faces.component.UIInput.updateModel(UIInput.java:866)
            at javax.faces.component.UIInput.processUpdates(UIInput.java:749)
            at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1291)
            at javax.faces.component.UIForm.processUpdates(UIForm.java:281)
            at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1291)
            at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1291)
            at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1291)
            at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:1254)
            at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78)
            at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
            at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
            at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
            at com.dwadmin.filters.AuthorizationFilter.doFilter(AuthorizationFilter.java:48)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
            at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
            at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
            at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
            at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
            at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
            at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
            at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
            at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
            at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
            at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
            at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
            at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
            at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
            at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
            at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
            at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
            at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
            at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
            at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
            at java.lang.Thread.run(Thread.java:748)
        Caused by: javax.el.PropertyNotFoundException: /patient_blankPage.xhtml @16,173 value="#{usertagsController.selected.chipId}": Target Unreachable, 'null' returned null
            at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:133)
            at javax.faces.component.UIInput.updateModel(UIInput.java:832)
            ... 44 more
        Caused by: javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null
            at com.sun.el.parser.AstValue.getTarget(AstValue.java:192)
            at com.sun.el.parser.AstValue.setValue(AstValue.java:226)
            at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:294)
            at org.jboss.weld.el.WeldValueExpression.setValue(WeldValueExpression.java:64)
            at com.sun.faces.facelets.el.TagValueExpression.setValue(TagValueExpression.java:131)
            ... 45 more
    
Tiny
  • 24,933
  • 92
  • 299
  • 571
Vijen
  • 1
  • 2
  • Because `selected` in `#{usertagsController.selected.chipId}` is null? – Kukeltje Jul 15 '17 at 07:27
  • selected is Select one menu field that gets selected by user. I already select edthat field . – Vijen Jul 17 '17 at 14:08
  • If you are 1000% then the usertagsController is null...but that would then be impossible. So I still say the 'selected' is null... – Kukeltje Jul 17 '17 at 14:10

1 Answers1

0

This is because the field "selected" is null. It needs to be initialized during the construction of the UsertagsController object (ideal place would be in the constructor) in order for the update model phase to update the value.

OTM
  • 646
  • 5
  • 8
  • I already had initialize it in my controller class super(UserTags.class); – Vijen Jul 17 '17 at 16:01
  • You are just passing the UserTags class object to the super class constructor by that. But the code does not assign a value to the field selected so it's null. – OTM Jul 17 '17 at 17:20
  • field selected is set when user selects value = usertagsController.selected.chipId so I am selecting it – Vijen Aug 01 '17 at 14:37
  • No, it's not set... What object does selected hold ? If it's podController.item then from usertagsController.selected.chipId in the selectIneMenu you need to remove chipId and have only value="usertagsController.selected". Can you check if it works or not.. – OTM Aug 02 '17 at 06:07