I’m trying to pass information from my servlet to a jsp , where some fields are passed successfully and some aren’t .
This is the initial page where I enter the input :

The code of index.html
<!DOCTYPE html>
<html>
<head><title>Bank application</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<table class="title">
<tr><th>Web Bank application</th></tr>
</table>
<br/>
<fieldset>
<legend>Registration</legend>
<form action="register">
First name: <input type="text" name="firstName"><br>
Last name : <input type="text" name="lastName"><br>
Address : <input type="text" name="address"><br>
ID-number : <input type="text" name="idnumber"><br>
User-Name : <input type="text" name="userName"><br>
Password : <input type="text" name="password"><br>
<input type="submit" value="Register">
</form>
</fieldset>
And I want to pass the data to a jsp that’s called show-name.jsp :
<!DOCTYPE html>
<html>
<head><title>Thanks for Registering</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<h1>Congratulations ! You are now registered to our bank</h1>
<h2>First Name: ${name.firstName}</h2> // that's okay
<h2>Last Name: ${name.lastName}</h2> // that's okay
<h2>Address: ${name.address}</h2> // that's okay
<h2>Password: ${name.password}</h2> // that's okay
<h2>User-Name: ${name.userName}</h2> // that's not okay
<h2>Id Number: ${name.idnumber}</h2> // that's not okay
</body></html>
I get the following Exception in Eclipse :
root cause
javax.el.PropertyNotFoundException: Property 'userName' not found on type model.Person
OR :
root cause
javax.el.PropertyNotFoundException: Property 'idnumber' not found on type model.Person
What’s weird is , that all the other 4 fields are presented great , meaning name.firstName & name.lastName & name.address & name.password , but the other two are not , even though that I added a couple of System.out.prinln-s :
System.out.println(person.getID());
System.out.println(person.getUsername());
In the servlet , and the data is presented to the console successfully , meaning I get :
4444
5555
. But from some reason the data is partially not passed to the jsp .
Why ?
Thanks
I think it is because EL uses getters for getting properties of bean.
In your
Personbean getter foridnumberis notgetIdnumberorisIdnumberbutgetIDso you can see error that say that property ‘idnumber’ can’t be found on type model.Person.Same about getter for
userNameit is notgetUserNamebutgetUsername