0

When page load why it's calling to Action ? Due to this page is not loading as it's throwing nullpointer inside. How can I avoid load the action?

I'm using JBOSS wildfly-10.1.0.Final

This is actually a working code I copied from another project and there this code is working fine.

Below is the snippt of my code. I will not put the whole file as it's bit big.

<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html">

<body>
<ui:composition template="/template/master-layout.xhtml">
<ui:define name="head">
   <script src="https://apis.google.com/js/platform.js" async="async defer">     </script>
<meta name="google-signin-client_id" content="63091603994-mlh4mm45b0ept7ci0pg0051qurl4c765.apps.googleusercontent.com"> </meta>

    <script type='text/javascript' src='#{uiHelperBean.cssjsRootUrl}/js/jquery.tipsy.js'></script>
    <script type='text/javascript' src='#{uiHelperBean.cssjsRootUrl}/js/app.js'></script>
    <link href="#{uiHelperBean.cssjsRootUrl}/css/login.css" rel="stylesheet" type="text/css" />
</ui:define>

<ui:define name="mainContainer">

  <h:form id="login-form">
     <div class="col-sm-10  ">
       <h:inputText id="username" maxlength="50"  placeholder="Enter email" styleClass="emailAddressOnly cust-email form-control login-input "
      tabindex="1">
         <f:validator validatorId="emailValidator"/>
         <f:attribute name="label" value="Email Address"/>
       </h:inputText>
       <span class="glyphicon glyphicon-user "></span>
     </div>
     <div class="col-sm-10">
        <div class="inner-addon left-addon">
            <span class="glyphicon glyphicon-lock form-control-feedback1"></span>
            <h:inputSecret id="password" redisplay="true" maxlength="20" autocomplete="off"styleClass="form-control login-input cust-password" tabindex="2">
              <f:validator validatorId="passwordValidator"/>
              <f:attribute name="label" value="Password"/>
            </h:inputSecret>
        </div>
      </div>
     <div class="form-group">                
       <div class="col-sm-10  ">
        <p:commandLink id="login" tabindex="3" update="@form" value="Sign In" action="#{userBean.login()}" styleClass="btn btn-danger signin custom-width" onstart="showSpinner('Please wait');" oncomplete="hideSpinner();" onmouseover="">
          <i class="glyphicon glyphicon-play-circle"></i>
        </p:commandLink>
       </div>
     </div>

   </h:form>
  </ui:define>
</ui:composition>
</body>
</html>

Faces-config.xml

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- This file is not required if you don't need any extra configuration. -->
<faces-config version="2.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-facesconfig_2_0.xsd">

<navigation-rule>
<from-view-id>/*</from-view-id>
<navigation-case>
    <from-outcome>login</from-outcome>
    <to-view-id>/login.xhtml</to-view-id>
    <redirect/>
</navigation-case>
<navigation-case>
    <from-outcome>registration</from-outcome>
    <to-view-id>/login/reg.xhtml</to-view-id>
    <redirect/>
</navigation-case>
<navigation-case>
    <from-outcome>forgetpassword</from-outcome>
    <to-view-id>/login/reset-password.xhtml</to-view-id>
    <redirect/>
</navigation-case>
<navigation-case>
    <from-outcome>logout</from-outcome>
    <to-view-id>/logout.xhtml</to-view-id>
    <redirect/>
</navigation-case>
<navigation-case>
    <from-outcome>contact-us</from-outcome>
    <to-view-id>/contact-us.xhtml</to-view-id>
    <redirect/>
</navigation-case>
</navigation-rule>

<navigation-rule>
    <from-view-id>/login.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>login_force_change_password</from-outcome>
        <to-view-id>/login/change-password.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>
<navigation-rule>
    <from-view-id>/login/pin-activation.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>validatepin_success</from-outcome>
        <to-view-id>/login/pin-activation-success.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>
<navigation-rule>
    <from-view-id>/login.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>login_force_change_password</from-outcome>
        <to-view-id>/login/change-password.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>

ever alian
  • 1,028
  • 3
  • 15
  • 45
  • Are you sure PrimeFaces is working at all? This mostly happens when the PrimeFaces tags are not recognized and actually not rendered but interpreted as text. The 'method' is called on render-time then. So please remove the commandLink, add a simple `p:outputLabel` there with a fixed value and look at the source in the browser after the page is renderd – Kukeltje Jun 30 '17 at 10:17
  • @Kukeltje I tried with a `p:outputLabel`. yes I can see it the view source. Moreover, if I remove the `action` in the `p:commandLink`, it's loading the page and show the button properly. – ever alian Jul 01 '17 at 04:44

0 Answers0