jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes Converting html frames to jsp includes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Converting html frames to jsp includes" Watch "Converting html frames to jsp includes" New topic
Author

Converting html frames to jsp includes

balajik Kumar
Greenhorn

Joined: Aug 18, 2012
Posts: 4
I was trying to re-factor my application by converting html frames to jsp includes. The code sample for html frames is as follows

<frameset rows="97,*,40">
<frame name="header" src="header.jsp" />
<frameset cols="250,*">
<frame name="menu" src="sidemenu.jsp" />
<frame name="Content" src="<%=url%>" />
</frameset>
<frame name="footer" src="footer.jsp" />
</frameset>

my side menu.jsp is put in a frameset which is divided into two parts(menu,content) and the menu part has several hyper links. So when i ever i click on hyper link, page gets loaded into second part(content) and my side menu remains in the first half. In this case only the second half gets reloaded for very click on the side link or any part of the content.

Now we need to remove the frames concept and i was trying with table layout(which i would later move to css implementation).
Code:

<table border="1" cellpadding="2" cellspacing="2" align="left">
<tr>
<td height="97" colspan="2" width="1000"><jsp:include page="header.jsp" /></td>
</tr>
<tr>
<td height="250" width="250"><jsp:include page="sidemenu.jsp" /></td>
<td><jsp:include page="<%=url%> /></td>
</tr>
<tr>
<td height="40" colspan="2"><jsp:include page="footer.jsp" /></td>
</tr>
</table>

In this case, when i ever i click on hyper link of menu it gets loaded in a separate tab rather than in second <td>(content) of the table, this is because my menu and content are not in a separate frame. I am really struggling here, i want to get the data which i get from the hyper link into second column of second row with out the whole page getting refreshed.

With frames whatever changes that i do in the content page gets refreshed in content page only, i wanted to achieve the same using some other means(jsp include/tiles). can you please guide me
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2057
The jsp:include is not dynamic in the way that frames are. It is only for 'including' content, once and only once; the very first time it is served to the browser along with the rest of the page.

You can use frame again in that area only. The rest seem to be static areas which dont need frames at all.

Another way is by using ajax. You will retrieve data using ajax, and then load that content into the div (where the frame used to be). It can be done using xml, or json-formatted data from the server. Jquery can help in this ajax communication.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Converting html frames to jsp includes