File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inheritance works differently in JSP

 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the following code:

There are two classes: an abstract Person and Employee class.
The Employee class extends Person class.
The Person class has two methods: getName() and setName(String)
The Employee class has two Methods: getEmpID() and setEmpID(int)

As per the above code, the "username" reference is of type Person and refer to an Employee object.

so using the "username" reference, we can call only the methods from Person class because while compiling, JAVA looks at the reference type.

But in the above code, I have called the classes from the Employee class using the Person reference and it works. see the following code

<jsp:setProperty name="username" property="*"/>
<jsp:getProperty name="username" property="empID"/>

Can anyone clarify this concept.

Thanks,
Ramkumar
So only


[BPSouther: Added code tags]
[ September 07, 2007: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ramkumar",
Please check your private messages.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP uses reflection to locate the methods in your beans.

I know this is in the JSP spec but I'm not able to locate it quickly.
[ September 07, 2007: Message edited by: Ben Souther ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic