ajaxGet returning a 'Session Timeout, Refresh browser' issue
zarathos Aug 27, 2010 10:32 AMOne of the projects that I am working on is the migration of a Struts 2 application into the GateIn Portal. The previous application used ajax as a critical part of the application. Unfortunetly, I do not have the time to learn or resource the of Groovy portlet concept, as we are already way behind on our project. I have gone through and converted the application to utilize the Struts 2 Portlet Bridge. One of the steps that needs to be handled is to make an ajax struts 2 action call and update a div with the new information.
The initial page loads as expect, no fuctionality included.
jsp:
....
// function to make ajax call
function getReport(){
// get action url
action = document.getElementById('reportAction').innerHTML;
// preform get and callback will be setReport function
ajaxGet(action, setReport);
}
// function to update div with new info from ajax call
function setReport(instance){
document.getElementById('report').innerHTML = instance.responseText;
}
...
<a href="#" onclick="getReport();">Today</a>
...
<!-- Create url for the struts 2 action that needs to be called -->
<s:url action="bandwidthReport" portletUrlType="action" id="reportActionURL" var="reportActionURL"/>
<!-- Set value of the struts 2 action url in div -->
<div id="reportAction" style="display:none"><s:property value="%{reportActionURL}"/></div>
...
...
<!-- div to display new content from ajax call -->
<div id="report" style="display: block"></div>
...
So when I click on the Today link, I can see in firebug that a new Get ajax request is being executed; however, I get an alert from the browser stating that my 'Session Timeout ! Refresh your browser'. For a brief moment I do see my <div id="report"> updated with new content. Upon looking at the response in the browser, if appears to be a complete set of my current Portal page with out the new content and not the segment that I was expecting. So I am assuming that I need to modify my call to do something with the PortletResponse.blocksToUpdate attribute or HttpResponseHandler.updateBlocks method.
I've read through the documentation, but am still at a loss on my next step. Any help would be greatly appreciated!!
Thanks!!
James..