aspose file tools*
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
JavaRanch » Java Forums » Java » JSP
Bookmark "Concrete class problem in EL" Watch "Concrete class problem in EL" New topic
Author

Concrete class problem in EL

Bobby Sharma
Ranch Hand

Joined: Mar 18, 2008
Posts: 574
    
    1

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)
{
this.name=name;
}

public String getName()
{
return name;
}

}

-------------------

package foo;

public class Employee extends Person{

private int empID;

public void setEmpId(int empID)
{
this.empID=empID;
}

public int getEmpId()
{
return(empID);
}

}
----------------------
<html>
<body>
<form action="JspEL.jsp">
#ID <input type="text" name="empID">
name <input type="text" name="name"><br>
Done <input type="submit">
</form>
</body>
</html>
-------------------------------
<%@ 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"/>
</jsp:useBean>
<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.


Back to Java , again.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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


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

Joined: Mar 18, 2008
Posts: 574
    
    1

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

thanks for the reply

best regards,
omi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Concrete class problem in EL