Example:page1.jsp
<%@page language=”java” %>
<html>
<head><title>Hello World JSP Page.</title></head>
<body>
<font size=”10″>
<%
String name=”Java”;
out.println(“Hello ” + name + “!”);
%>
</font>
</body>
</html>
Example:page4.jsp
<%@page import=”abc.ex” %>
<html>
<head><title>Example of Extends
Attribute of page Directive in JSP</title></head>
<body>
<font size=”20″ color=”red”>
<%
ex ex1 = new ex();
out.print(ex1.show());
%>
</font>
</body>
</html>
Here is the code of ex.java file:
package abc;
public class ex{
public String show(){
return “Java”;
}
}