SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 92 | Next

Deepak Vohra

"Ajax in Oracle JDeveloper"

3 Creating a DWR Application 101
parameter. The validate method is invoked with callback function
getValMessage and the userId value.
function validateUserId(){
var userId = DWRUtil.getValue(???userId???);
UserRegistration.validate(getValMessage, userId);
}
The callback function may also be specified as a call meta-data object.
UserRegistration.validate(userId, {
callback:function(msg) { }
});
When the Ajax request is complete the callback function
getValMessage gets invoked with the boolean returned by the
validate method as an argument. In the getValMessage callback
function, if the boolean returned is true implying that the User Id is
not defined in the database display the validation message ???User ID is
valid???. If the boolean is false display the validation message ???User
ID is not valid???. If the User Id is valid specify the Password field and
submit the user entry with the Submit button, which invokes the
addUserRegistration() JavaScript function. In the
addUserRegistration() function retrieve the values for the
different form fields and invoke the remote method updateUserTable
with a callback function and the field values as parameters. In the Java
class method updateUserTable obtain a connection with the MySQL
database and create a user entry. The callback function clearForm clears
the user entry form. The userregistration.jsp is listed below.


Pages:
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104