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 :
<INPUT TYPE="text" name="p_email">
<BR> Age :
<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: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets