JSP Frameset

The frameset element holds two or more frame elements. Each frame element in itself holds a separate document.

JSP Frameset

JSP Frameset

        

The <frameset> tag  is used to define a frameset.

The frameset element holds two or more frame elements. Each frame element in itself holds a separate document.

The frameset element decides the number of columns and rows within a frameset.

Understand with Example

This section illustrates you how to use the html tag frameset in jsp. In the given example, we have used four jsp pages:
1) frameset.jsp
2) frame1.jsp
3) frame2.jsp
3) frame3.jsp

The frameset tag holds two or more frames and each frame holds a separate document. By using its attributes rows and columns, you can set the number of rows and columns you want to be in the frameset. In the jsp page frameset.jsp, we have create three frames and using the attribute src, we have display the content of the specified jsp page to the respective frame. The attribute scrolling scrolls the frame. By default its value is true.

Here is the code of frameset.jsp

<html>
<head>
<title>Jsp Frameset</title>
</head>
<frameset rows="10%,*">
<frame src="frame1.jsp" name="frame1"scrolling="no">
<frameset cols="20%,*">
<frame src="frame2.jsp" name="frame2">
<frame src="frame3.jsp" name="frame3">
</frameset>
</frameset>
</html>

Here is the code of frame1.jsp

<html>
<body bgcolor="lightBlue">
<h2>Java Tutorial</h2>
</body>
</html>

Here is the code of frame2.jsp

<html>
<body bgcolor="pink">
<h3>Contents</h3>
<ul><li>Core Java</li>
<li>JSP</li>
<li>Java Servlets</li>
<li>JDBC</li>
<li>Hibernate</li></ul>
</body>
</html>

Here is the code of frame3.jsp

<html>
<body bgcolor="pink">
<h3>Click the following links:</h3>
<a href="http://www.roseindia.net/java">Core Java</a><br>
<a href="http://www.roseindia.net/jsp" >JSP</a><br>
<a href="http://www.roseindia.net/servlets/index.shtml">Java Servlets</a><br>
<a href="http://www.roseindia.net/jdbc">JDBC</a><br>
<a href="http://www.roseindia.net/hibernate">Hibernate</a><br>
</body>
</html>

Output will be displayed as:

Download Source Code: