This week's book giveaway is in the Android forum.
We're giving away four copies of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java and have Shai Almog on-line!
See this thread for details.
Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

inheritance works differently in JSP  RSS feed

 
Ranch Hand
Posts: 83
  • 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 ]
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 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
  • 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 ]
 
Pay attention! Tiny ad!
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!