my dog learned polymorphism
The moose likes JSP and the fly likes Concrete class problem in EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Concrete class problem in EL" Watch "Concrete class problem in EL" New topic

Concrete class problem in EL

Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 598

This example is from HFSJ.I follow this example and get exception
while I try to get value of empID of Concrete class Employee.

org.apache.jasper.JasperException: Cannot find any information on property 'empID' in a bean of type 'foo.Employee'

here is full example

package foo;

public abstract class Person{

private String name;

public void setName(String name)

public String getName()
return name;



package foo;

public class Employee extends Person{

private int empID;

public void setEmpId(int empID)

public int getEmpId()

<form action="JspEL.jsp">
#ID <input type="text" name="empID">
name <input type="text" name="name"><br>
Done <input type="submit">
<%@ page contentType="text/html; charset=UTF-8" %>
<jsp:useBean id="person" type="foo.Employee" class="foo.Employee">
<jsp:setProperty name="person" property="name"/>
<jsp:setProperty name="person" property="empID"/>
<br>Name is : <jsp:getProperty name="person" property="name" />
<br> ID : <jsp:getProperty name="person" property="empID"/>
note:I am able to get name perfectly but the problem is empID.

I know you must have encountered this example on the book.

Most of the programming problems can't be solved because you don't know what the exact problem is.
Defining your problem correctly leads you to the right solution.
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Getters and Setters must follow the Java Beans naming rule.
empID -> setEmpID, getEmpID
empId -> setEmpId, getEmpId

[My Blog]
All roads lead to JavaRanch
Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 598

Well,I have solved my Problem.The problem was the same you told me.

thanks for the reply

best regards,
I agree. Here's the link:
subject: Concrete class problem in EL
It's not a secret anymore!