Search This Blog

Saturday, September 5, 2009

How to Include Inteface in JSP?

When i was started working as a TL.I have to give the technical assistance to my subordinate.
So one day he asked my how to include interface in JSP and access the interface static value.
I gave the answer as,


1. It’s possible to include Interface in jsp use bean class tag.
• No because java cants instances the object for the interface so jsp use bean will throws the error.
• Eg:
2. It’s possible to include with out constructer java Class file in jsp use bean class tag.
• No, because its can’t create object for the with out constructer class java.
• Its throw error.
3. How to access Interface static variable in Jsp file?
• Its possible, there is two possible for that
• Way1: we have to import the javaclass which has implemented the java interface
• Create the object for that interface implemented class, using the reference variable we can access the interface final variable.
• Acc_Cheque_Detail acd=new Acc_Cheque_Detail();acd.RECEIVED
• Way2: we have to create interface reference variable assign the implemented the class objects.
• Using that interface reference variable we can access the interface final variable.

No comments:

Post a Comment