Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset
Comments Off on JSP: Comment utiliser les classes abstraites en jsp

JSP: Comment utiliser les classes abstraites en jsp

<HTML>
    <HEAD>
        <TITLE>Using Abstract Classes</TITLE>
    </HEAD>
 
    <BODY>
        <H1>Using Abstract Classes</H1>
 
        <%!
            javax.servlet.jsp.JspWriter localOut;
 
            abstract class a
            {
                abstract String getText() throws java.io.IOException;
 
                public void printem() throws java.io.IOException 
                {
                    localOut.println(getText());
                }
            }
 
            class b extends a
            {
                String getText() throws java.io.IOException 
                {
                    return "Hello from JSP!";
                }
            }
        %>     
        <%
            localOut = out;     
 
            b bObject = new b();
 
            bObject.printem();
        %>
    </BODY>
</HTML>