Loading a JSP into an IFrame

C

Chris Moltisanti

Hi,

I am implementing AJAX into my application but I am having a bit of
trouble displaying the results that are returned. I am using JSP pages
and I have my HTML for my results in a separate JSP, restults.jsp.
In the main JSP I execute a search using the XMLHTTPRequest object.
When the response comes back I create a new IFrame and set the source
of the IFrame as my results.jsp. I then append the IFrame to my main
JSP page.
The HTML in my results.jsp is displayed perfectly, however none of my
search results are displayed. I think this is because my lists of
results is not being evaluated correctly by my JSP tags in results.jsp.
Is there any way that I can get my JSP tags to evaluate my list of
search results? or is this not possible.....

Thanks

Chris

Here is the AJAX javascript and the results.jsp

function ajaxSearch(url) {

if (window.XMLHttpRequest)
{ // Non-IE browsers
req = new XMLHttpRequest();
req.onreadystatechange = processStateChange;
try
{
req.open("GET", url, true);
} catch (e) {
alert(e);
}
req.send(null);
} else if (window.ActiveXObject) { // IE
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processStateChange;
req.open("GET", url, true);
req.send();
}
}
}

function processStateChange()
{
if (req.readyState == 4)
{ // Complete
if (req.status == 200)
{ // OK response
var myIframe = document.createElement('IFRAME');
myIframe.src = 'results.jsp';
myIframe.style.width = "900px";
myIframe.style.border = "0px";
var table = document.getElementById('searchTable');
table.appendChild(myIframe);
//alert(req.listOfRegs);
} else {
alert("Problem: " + req.statusText);
}
}
}

RESULTS.JSP

<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<html>
<!-- CSS files-->
<link rel="stylesheet" href="../../css/menuGreen.css" />
<link rel="stylesheet" href="../../css/green.css" />
<link rel="stylesheet" href="../../css/global.css" />

<!--Favorites Icon-->
<link rel="shortcut icon" href="../../img/favicon.ico" />

<!--JSTL imports-->
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!-- Javascript files-->
<SCRIPT src="../../javascript/util.js"></SCRIPT>
<SCRIPT src="../../javascript/menu.js"></SCRIPT>
<SCRIPT src="../../javascript/jquery.js"></SCRIPT>
<SCRIPT src="../../javascript/thickbox.js"></SCRIPT>
<table cellpadding="0" cellspacing="0" border=0 width="100%"
height="100%" >
<tbody>
<tr>
<td class="sbubble tls" width="24px" height="25px"></td>
<td class="sbubble t">&nbsp;</td>
<td class="sbubble trs" ></td>
</tr>
<tr>
<td class="sbubble l">&nbsp;</td>
<td class="sbubble" rowspan="1" align="center" width="95.1%">
<display:table name="listOfRegs" defaultsort="1"
defaultorder="descending" width="100%">
<display:setProperty name="css.table" value="searchTable" />
<display:setProperty name="basic.empty.showtable" value="true" />
<display:column property="registrant.firstName" title="First Name"
href="/ejc/struts/register/registrationUpdateAction.do?methodToCall=preUpdate"
paramId="registrantId" paramProperty="registrantId" sortable="true"
headerClass="sortable" />
<display:column property="registrant.lastName" title="Last Name"
href="/ejc/struts/register/registrationUpdateAction.do?methodToCall=preUpdate"
paramId="registrantId" paramProperty="registrantId" sortable="true"
headerClass="sortable"/>
<display:column property="registrant.email" title="Email"
sortable="true" headerClass="sortable" />
<display:column property="registrantType.registrantTypeDesc"
title="Registrant Type" sortable="true" headerClass="sortable" />
<display:column property="registrantStatusType.statusDesc"
title="Status" sortable="true" headerClass="sortable" />
</display:table>
</td>
<td class="sbubble r">&nbsp;</td>
</tr>
<tr>
<td class="sbubble bls" width="24px" height="25px"></td>
<td class="sbubble b">&nbsp;</td>
<td class="sbubble brs"></td>
</tr>
</tbody>
</table>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,813
Messages
2,569,699
Members
45,489
Latest member
SwethaJ

Latest Threads

Top