Home Answers Viewqa JSF-Questions Error handling

 
 


Sakai
Error handling
1 Answer(s)      3 years and 5 months ago
Posted in : Java Server Faces Questions

View Answers

December 18, 2009 at 10:55 AM


Hi Friend,

Modify your code:

1)index.jsp:

<html>
<head>
<script src="validation.js" type="text/javascript"></script>
</head>
<form method="post" name="form" onsubmit="return validate();" action="../DropDown" >
<table border="0">
<tr align="left" valign="top">
<td> Name: </td>
<td><input type="text" name="name"/> </td>
</tr>
<tr align="left" valign="top">
<td>Presentation: </td>
<td><input type="text" name="score"/></td>
</tr>
</table>
<select name="Feedback" multiple="multiple">
<option> "Poor"</option>
<option>"Good"</option>
<option>"Very Good"</option>
<option>"Excellent"</option>
</select>
<input type="Submit" value="Submit">
</form>
</html>

2)validation.js:
function checkName(text) {
if(isNaN(text)){ return 1;}
else{alert("Please enter a valid name. The only charachters accepted are A - Z and a - z");return 0;}
}
function checkNumber(num) {
if(isNaN(num)){alert("Enter only numbers. The only characters permitted are 0 to 9"); return 0;}
else{return 1;}
}

function validate(){
var uname=document.form.name;
var uscore=document.form.score;

if ((uname.value==null)||(uname.value=="")){
alert("Please Enter your Name")
uname.focus()
return false
}

if (checkName(uname.value)==false){
uname.value=""
uname.focus()
return false
}
if (uname.value.length>25){
alert("Should not have more than 25 characters!")
return false;
}

if ((uscore.value==null)||(uscore.value=="")){
alert("Please Enter your score")
uscore.focus()
return false;
}
if (checkNumber(uscore.value)==false){
uscore.value=""
uscore.focus()
return false;
}
if ((uscore.value>100)||(uscore.value<0)){
alert("Score must be in between 0 amd 100")
return false;
}

return true;

}

Thanks









Related Pages:
error handling mechanism
error handling mechanism  What is Java error handling mechanism
php error handling function
php error handling function  Is there any library or function that can be used to handle errors in PHP
PHP Error handling
PHP Error handling: PHP provides so many techniques to handle error, if error occurs an error message is send to the browser. Error handling should... application. In this tutorial you will come to know about different handling methods
Error handling - Java Beginners
Error handling  Hello, Help me write code as instructed bellow for a Java program. 1. Create a new Movie class which has two properties, title and rating. 2. Create a new Cinema class, add method addMovieGoers which takes
PHP Error handling
PHP Error handling Your application must have an error handling codes. Without it, it looks very unprofessional. PHP have following error handling methods... handling using set_error_handler() function as follows : <?php //error handler
Exception Handling-Error Messages in Program
Exception Handling-Error Messages in Program  Sorry about the first code block: import java.util.*; class GradeException extends Exception{ public GradeException(String s){ System.out.println(s); } } ----jGRASP exec: javac -g C
exception handling code for file not found error..
exception handling code for file not found error..  How to do exception handling for file not found error
Exception Handling-Error Messages in Program
Exception Handling-Error Messages in Program  Hi Friend, I am having trouble running this code as per my prior question on Exception handling... with this. Here is the code with the error messages as Follows: import
exception handling
the working code and the error-handling code can be disintegrated. It also gives us... of exception handling mechanism.   Java Exception Exception... an exception whenever a calling method encounters an error providing
PDO Error Handling
PDO Error Handling: In this current tutorial we will study about the error handling methodology in PDO extension. In general we use try and catch block to handle the errors in the database connection but to handle other kind
Error handling - Java Server Faces Questions
Error handling  How to handle error handling in JavaScript? Say we have this index.jsp file and we like to add some JavaScript into it based... otherwise give an error
Exception handling
Exception handling  how to resolve file not found error exception
Error handling - Java Server Faces Questions
Error handling  How to handle error handling in JavaScript? Say we have this index.jsp file and we like to add some JavaScript into it based... otherwise give an error. *The score here must be between 0 - 100
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT  Prompt the user to enter the name of a text file to search for. If the name does not end in a .txt extension, display an error message. Search for this file in the current directory. If the file does
Error Handling in Java Script
Error Handling in Java Script  ... will Learn how to handle error in java script. JavaScript is scripting language used for client side scripting. and error are handling in two ways.   *try
Excpetion handling for this situation
Excpetion handling for this situation  if i have search program and if the search for a particular string fails the method should return an exception or error message. Basically user defined exception, how do i do that?  
Exception Handling
Exception Handling      ... exceptions are used for handling errors in programs that occurs during the program execution. During the program execution if any error occurs and you want
File Handling - Java Beginners
) { System.err.println("Error writing to file...(); } catch (Exception e){ System.err.println("File input error
Exception Handling in Java
for handling errors in programs that occurs during the program execution. During the program execution if any error occurs and you want to print your own message or the system message about the error then you write the part of the program
File Handling - Java Beginners
number of time i run that program..If there is some syntax Error then i am sorry
Exception handling - JSP-Servlet
encountered an internal error () that prevented it from fulfilling this request
Exception Handling
Exception Handling      ... are used for handling errors in programs that occurs during the program execution. During the program execution if any error occurs and you want to print your own
Handling exception in jsp - JSP-Servlet
Handling exception in jsp  In my servlet i have an exception object. I am passing that object to jsp error page, But i am unable to handle that exception in my jsp page. Server is showing some error other than my error page
Java Exception - Exception Handling in Java
Java Exception - Exception Handling in Java  .... Actually exceptions are used for handling errors in programs that occurs during the program execution. During the program execution if any error occurs and you
Exception handling through Struts - Struts
Exception handling through Struts  I am using eclipse 3.2 and developing project in struts. I want to do error handling through struts. I have used.... It is not showing me that error page whatever I have entered in my web.xml My web.xml
Handling exception in jsp - JSP-Servlet
Handling exception in jsp  Hi Here is the sample code of servlet protected void doPost(HttpServletRequest request, HttpServletResponse... error page.   Hi friend, Please use of try
PHP  Exception Handling
PHP  Exception Handling PHP 5 has included a new way of error handling - Exception handling, which is present in other OOP based programming language. In PHP there are three blocks in Exception Handling : try, catch, and throw. i
Spring Exception Handling
Spring Exception Handling In any web application it is always recommended to display user friendly custom error page rather than displaying long programming error code. In Servlet you can also map the error page as in the web.xml
Java : Exception Handling
Java : Exception Handling In this section we will discuss about  JAVA Exception Handling with simple example. Exception Handling : An exception... and also generates error message ,which is displayed  and it causes
java exception handling - Java Beginners
java exception handling  hi while i am compailing the program given below i am getting an error please help me as soon as possible import java.io.*; class insufbal extends Exception { public insufbal(String str) { super
PHP File Handling
PHP File Handling: Every language supports File handling, file handling has... file handling. PHP supports this feature using the following functions: i) ... is not present x write only, returns an error message and false
JavaScript Exception Handling
JavaScript Exception Handling: Try...catch block help to handle the exception handling, try..catch block works together.  You use the catch statement... with an error, which is something in the code that has been written incorrectly
Using throw keyword in exception handling in Core Java
Handling: package exceptionh; import java.io.*; class ExcepHandling1...; + ex.getMessage()); throw new Error("File not found"
exception handling
exception handling  explain about exception handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
event handling
event handling  diff btwn event handling in ASP.net and in HTML
Difference between error and exception ????????
Difference between error and exception ?  Can we handle a error in java if yes than give an code of an example? Difference between error and exception handling.......   Exceptions are things you can create/throw
Write Log Records to Standard Error in Java
to standard error in Java. Java provides the facility for handling an error... Write Log Records to Standard Error in Java   ... or publishes log records on the standard error which is written in the log file
exception handling
exception handling  could you please tell me detail the concept of exception handling
correct the sql error
correct the sql error  i am getting a SQL Error while retriving data... jButton4ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here...(null,"Please enter the Student ID to Search","Error",0); } else { try
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.