title: NullPointerException exception after submitting commandButton(JSF 2.1)
body: <p>I am getting NullPointerException when I click on commonButton to submit the page:</p>
  
  <pre><code>SEVERE: javax.servlet.ServletException
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
  at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
  at ca.bc.gov.hlth.template.filter.ProcessFilter.doFilter(ProcessFilter.java:125)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
  at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
  at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
  at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
  at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
  at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
  at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
  at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
  at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
  at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
  at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
  at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
  at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
  at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
  at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
  at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
  at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
  at java.lang.Thread.run(Thread.java:662)
  Caused by: java.lang.NullPointerException
  at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:1402)
  at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:785)
  at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181)
  at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
  at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
  at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:933)
  at com.sun.faces.extensions.avatar.components.PartialTraversalViewRootImpl.processDecodes(PartialTraversalViewRootImpl.java:147)
  at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
  at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
  ... 29 more
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
      &lt;display-name&gt;SSD&lt;/display-name&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;org.richfaces.skin&lt;/param-name&gt;
          &lt;param-value&gt;CUSTOM&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
      &lt;param-name&gt;org.richfaces.enableControlSkinning&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;org.richfaces.push.jms.enabled&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
          &lt;param-value&gt;client&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;com.sun.faces.validateXml&lt;/param-name&gt;
          &lt;param-value&gt;false&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;com.sun.faces.verifyObjects&lt;/param-name&gt;
          &lt;param-value&gt;false&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;com.sun.faces.expressionFactory&lt;/param-name&gt;
          &lt;param-value&gt;com.sun.el.ExpressionFactoryImpl&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;ExceptionHandlerServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;errorHost&lt;/param-name&gt;
              &lt;param-value&gt;localhost&lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;errorPort&lt;/param-name&gt;
              &lt;param-value&gt;24444&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/servlet&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;JsonSearch&lt;/servlet-name&gt;
          &lt;servlet-class&gt;ca.bc.gov.hlth.swt.map.JsonSearchServlet&lt;/servlet-class&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;JsonSearch&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.json&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;filter&gt;
          &lt;filter-name&gt;ProcessFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;ca.bc.gov.hlth.template.filter.ProcessFilter&lt;/filter-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;error-page&lt;/param-name&gt;
              &lt;param-value&gt;/faces/Error.xhtml&lt;/param-value&gt;
          &lt;/init-param&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;ProcessFilter&lt;/filter-name&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
      &lt;/filter-mapping&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;com.sun.faces.config.ConfigureListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;ca.bc.gov.hlth.swt.util.StartupListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
      &lt;/session-config&gt;
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;faces/Home.xhtml&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
      &lt;error-page&gt;
          &lt;error-code&gt;403&lt;/error-code&gt;
          &lt;location&gt;/faces/AccessDenied.xhtml&lt;/location&gt;
      &lt;/error-page&gt;
      &lt;error-page&gt;
          &lt;error-code&gt;500&lt;/error-code&gt;
          &lt;location&gt;/faces/Error.xhtml&lt;/location&gt;
      &lt;/error-page&gt;
      &lt;jsp-config&gt;
          &lt;jsp-property-group&gt;
              &lt;url-pattern&gt;*.jspf&lt;/url-pattern&gt;
          &lt;/jsp-property-group&gt;
      &lt;/jsp-config&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>This is my faces-config.xml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  
  &lt;!-- =========== FULL CONFIGURATION FILE ================================== --&gt;
  
  &lt;faces-config version="2.1" 
      xmlns="http://java.sun.com/xml/ns/javaee" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"&gt;
    &lt;faces-config-extension&gt;
      &lt;facelets-processing&gt;
        &lt;file-extension&gt;.jspx&lt;/file-extension&gt;
        &lt;process-as&gt;jspx&lt;/process-as&gt;
      &lt;/facelets-processing&gt;
    &lt;/faces-config-extension&gt;
  
     &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;Map&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;swtwar.Map&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
      &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;Search&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;swtwar.Search&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
      &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;Home&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;swtwar.Home&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
      &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;LayoutWide&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;swtwar.LayoutWide&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
      &lt;managed-bean&gt;
          &lt;managed-bean-name&gt;Tester&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;swtwar.Tester&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
      &lt;navigation-rule&gt;
  </code></pre>
  
  <p>Here is the code I use for CommondButton; #{Home.search} returns 'search':
  view plaincopy to clipboardprint?
  Note: Text content in the code blocks is automatically word-wrapped</p>
  
  <pre><code>&lt;h:commandButton onclick="document.getElementById('form1:procedureFilter').value='';" action="#{Home.search}" value="Select Search Criteria" /&gt;  
  </code></pre>
  
  <p>Both Home.xhtml and Search.xhtml(home.xhtml --> Search.xhtml) are in the same folder.
  I also found that glassfish 3.1 is giving following error:
  view plaincopy to clipboardprint?
  Note: Text content in the code blocks is automatically word-wrapped</p>
  
  <pre><code>SEVERE: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory. Attempting to find backup.  
  </code></pre>
  
  <p>Any Help?</p>
  
  <p>Thanks</p>
  
  <p>Harbinder</p>
  
  <p>Update: After some work around I found that I'm actually getting NullPointerException from the ManagedBean:</p>
  
  <pre><code>WARNING: #{Home.search}: java.lang.NullPointerException
  javax.faces.FacesException: #{Home.search}: java.lang.NullPointerException
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
      at javax.faces.component.UICommand.broadcast(UICommand.java:315)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
      at ca.bc.gov.hlth.template.filter.ProcessFilter.doFilter(ProcessFilter.java:125)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      ... 36 more
  Caused by: java.lang.NullPointerException
      at swtwar.Home.search(Home.java:87)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
      ... 37 more
  
  INFO: HP_excptn:javax.servlet.ServletException: java.lang.NullPointerException: java.lang.NullPointerException
  SEVERE: javax.servlet.ServletException: java.lang.NullPointerException
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
      at ca.bc.gov.hlth.template.filter.ProcessFilter.doFilter(ProcessFilter.java:125)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
      at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
      at javax.faces.component.UICommand.broadcast(UICommand.java:315)
      at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
      at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
      at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      ... 29 more
  Caused by: java.lang.NullPointerException
      at swtwar.Home.search(Home.java:87)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
      at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
      at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
      ... 37 more
  </code></pre>
  
  <p>Here Home.Search is pointing to:</p>
  
  <pre><code>@ManagedProperty(value = "#{Search}")
  private Search search;
  @ManagedProperty(value = "#{Tester}")
  private Tester tester;
  
  public Home() {
  }
  
  public Search getSearch(){
      return this.search;
  }
  
  public void setSearch(Search search){
      this.search = search;
  }
  public String search() {
      if (siteId == null) {
          init();
      }
  
      tester.testing();
      return "tester";
  }
  </code></pre>
  
  <p>And tester is pointing to Tester.xhtml and testing() is a testing procedure of its bean class:</p>
  
  <pre><code>    @ManagedBean
      public class Tester implements Serializable
     {
      public Tester(){
      }
  
      @PostConstruct
      public void testing(){
      System.out.println("HP_Tester_Testing.....");
      }
     }
  </code></pre>