0

The declaration and the invoke is here:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>#{msgs.windowTitle}</title>
  <h:outputScript library="javascript" name="Resources/js/checkPassword.js" />
</head>

<body>
<h3>#{msgs.Entrance}</h3><br/><br/><br/>
<h:form>

<h:panelGrid columns="2" columnsClasses="evenColumns, oddColumns">

#{msgs.namePrompt}
<h:inputText/>

#{msgs.PasswordPrompt}
<h:inputSecret id="password" />

#{msgs.ConfirmPasswordPrompt}
<h:inputSecret id="passwordConfirm"/>

</h:panelGrid>

<h:commandButton type="button" value="Submit" onclick="checkPassword()" />
    </h:form>
    </body>

</html>

The checkpassdword.js

 function checkPassword(){
        alert("here it is");
        var password = form[form.id+":passwordConfirm"].value;

        var passwordConfirm = form[form.id+":password"].value;
        if(password==passwordConfirm){
            form.submit();
        }
        else{
            alert("Wrong");
        } 

    }

It is inside WebContent/Resources/js

when i write in put and, click button, nothing happens.

In explorer the error is in console

<script src="RES_NOT_FOUND" type="text/javascript"></script>

How can i solve this problem? I tried to put in src, webinf, meta inf and tried to declare as src not name but nothing happened.

The error unidentified checkPassword.

1 Answers1

0

Replace

<h:outputScript library="javascript" name="Resources/js/checkPassword.js" />

with

 <h:outputScript name="js/checkPassword.js"/>

and rename your Resources folder in your WebContent into resources

And go over the following thread What is the JSF resource library for and how should it be used?

Community
  • 1
  • 1
Daniel
  • 36,833
  • 10
  • 119
  • 200