The
include directive is used to include the content of other resource
like html, text or other jsp page into this jsp page at the time of
page translation.
Example
index.html
<!DOCTYPE html> <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <h1>I am include directive, used to include the content of other resource like html, text or other jsp page into the jsp page at the time of page translation </h1> </body> </html>
random.jsp
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Generate Random Number</title> </head> <body> <%@include file="index.html"%> <h1>Random Number: <% Random rand = new Random(); out.print(rand.nextInt()); %> </h1> </body> </html>
No comments:
Post a Comment