bean and exception

T

Thierry

Hello,
I want to manage that error : org.apache.jasper.JasperException: For input
string: "a"

I have a Bean with a method
public void setAge(int age) {
this.age = age;
}

I have a JSP
....
<jsp:useBean id="bean0" scope="session" class="test.Personne" />
<jsp:setProperty name="bean0" property="*" />
.....
Enter new value bean0.age : <input name="age">
the value is bean0.age is : <jsp:getProperty name="bean0" property="age" />
.....

I dont want to use javascript for validate my data
If I enter a letter in the aera and submit form
I have that error : org.apache.jasper.JasperException: For input string: "a"
How can I manage that exception ?

thank you

Thierry
 
C

Christophe Vanfleteren

Thierry said:
Hello,
I want to manage that error : org.apache.jasper.JasperException: For input
string: "a"

I have a Bean with a method
public void setAge(int age) {
this.age = age;
}

I have a JSP
...
<jsp:useBean id="bean0" scope="session" class="test.Personne" />
<jsp:setProperty name="bean0" property="*" />
....
Enter new value bean0.age : <input name="age">
the value is bean0.age is : <jsp:getProperty name="bean0" property="age"
/> ....

I dont want to use javascript for validate my data
If I enter a letter in the aera and submit form
I have that error : org.apache.jasper.JasperException: For input string:
"a" How can I manage that exception ?

Please don't multi-post, it is quite annoying.
Also, you'll need to post more of the exception you're getting. And when
does this happen? At runtime, or when the server tries to compile the jsp?
And does your bean have a getAge method?
 
T

Thierry

Sorry for multipost
The problem happens when y submit the form
An I have a getAge method ?

Thierry
 
C

Chris Smith

Thierry said:
<jsp:useBean id="bean0" scope="session" class="test.Personne" />
<jsp:setProperty name="bean0" property="*" />

I don't know how to catch that exception.

What I can contribute is that use of the wildcard version of
jsp:setProperty is universally considered to be a poor idea; even a
security risk if you're not very careful in separating trusted from
untrusted data in your application. I'd strongly recommend you look at
alternate ways of accomplishing this task, such as via Struts or JSF,
both of which provide convenient ways to parse input, fill in a bean,
and actually respond to validation or data conversion problems.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

java bean program 5
Bean Creation Exception in Springboot 0
jsp and usebeans 1
Problem on java bean 2
School Project 1
jasper exception 1
jsp..& bean...[help] 1
Cannot find bean exception ina ny scope 0

Members online

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top