I need to trigger an action when loading a JSP. To track the number of users who visited this page.
I have an action VisitorCounterActionwhere it updates the database. When loading the JSP, I call the ajax function callCounter();
{
alert("callCounter");
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",VisitorCounterAction,false);
xmlhttp.send(null);
alert("callCounter returned from Action");
}
I get an exception like:
/ web / guest / content? p_p_id = 31 & p_p_lifecycle = 0 & p_p_state = pop_up & p_p_mode = view & _31_struts_action =% 2Fimage_gallery% 2Fview_slide_show & _31_folderId = 10605 generates exception: null
Please help me with this. Or any other way to trigger an action. I cannot reload the page since it will call the load function again.
Thanks Dj
source
share