Use the javascript function below onchange of the input .

function alfaNum()
 {
  val=document.formname.inputname.value;
  if (val - val!=0)
    alert ("not an integer");
  else
    alert ("integer");
 }



----- Original Message -----
From: "BERWART Thierry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 05, 2001 5:03 PM
Subject: How can I catch an JSP error ????


> Hello,
>
> I have a jsp which filled a bean with 3 variables : a name, an address
email
> and an age.
>
> This is a part of my JSP :
>
> <%@ page import="test_tbe" errorPage="error.jsp" %>
>
> <jsp:useBean id ="test" scope="page" class="test_tbe" />
> <jsp:setProperty name="test" property="name" param="p_name"/>
> <jsp:setProperty name="test" property="email" param="p_email"/>
> <jsp:setProperty name="test" property="age" param="p_age"/>
>
> <HTML>
> <BODY>
> <BR><BR>
> Hello
> <BR>
> please enter your name and your email ...
>
> <FORM METHOD="GET">
> Name :
> <INPUT TYPE="text" name="p_name">
> <BR> Email :&nbsp;
> <INPUT TYPE="text" name="p_email">
> <BR> Age : &nbsp;
> <INPUT TYPE="text" name="p_age">
> <BR><BR>
> <INPUT TYPE="SUBMIT">
> ...
>
>
> in my bean, the variable is defined as an int.
> And so, when the user enter a string, I got an
> org.apache.jasper.JasperException ...
>
> My question is : is it possible to catch this exception and
> display an error message like " the age field must be numeric" ... ???
>
> Thanks
>
> Thierry
>
> This is my bean :
>
> import java.util.*;
> public class test_tbe
> {
>   private String name=null,email=null;
>   private int age;
>
>   public test_tbe()
>   {
>   }
>
>   public String getName()
>   {
>         return email;
>   }
>
>   public int getAge()
>   {
>         return age;
>   }
>
>   public void setName(String p_name)
>   {
>     name = new String(p_name);
>   }
>
>   public void setEmail(String p_email)
>   {
>         email = new String(p_email);
>   }
>
>   public void setAge(int p_age)
>   {
>     age = p_age;
>   }
>
> }
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to