How can we implement an interface in JSP page :
1. Implement interface in a class, then use this class in JSP .
2.
<%!
interface MyInter {
public String test();
}
class InterfaceImpl implements MyInter{
public String test(){
return "This is from MyInter - The Interface";
}
}
%>
<%
InterfaceImpl inter = new InterfaceImpl();
String str = inter.test();
out.println(str);
%>
1. Implement interface in a class, then use this class in JSP .
2.
<%!
interface MyInter {
public String test();
}
class InterfaceImpl implements MyInter{
public String test(){
return "This is from MyInter - The Interface";
}
}
%>
<%
InterfaceImpl inter = new InterfaceImpl();
String str = inter.test();
out.println(str);
%>
No comments:
Post a Comment