I am new to ajax. I am facing some problem while retrieving data.
In javaacript
function task(){
var xmlHttp = newXMLHttpRequest();
xmlHttp.onreadystatechange=function(){
if (xmlHttp.readyState == 4) {
alert("After Ajax" + xmlHttp.responseText );
}
}
xmlHttp.open("GET","Task1.do",true);
xmlHttp.send();
}
server side code.
public class CheckStatus extends Action {
String status = null;
LoadProperties properties = null;
HashMap propertiesMap = null;
HttpSession session = null;
public ActionForward execute(ActionMapping mapping, ActionForm
form,HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
try {
properties = new LoadProperties();
propertiesMap = LoadProperties.defaultMap;
session = request.getSession();
ArrayList taskList =
(ArrayList)session.getAttribute("taskList");
StringBuffer taskStatus = new StringBuffer();
Iterator i = taskList.iterator();
int index = 0;
/* Read Status from property file and store there status in
session
sttribute */
while(i.hasNext()){
i.next();
index++;
String propEntry = "task" + index;
taskStatus.append(((String)
propertiesMap.get(propEntry)) + "," );
}
taskStatus.deleteCharAt(taskStatus.length()-1);
session.setAttribute("taskStatus", taskStatus.toString());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
response.setContentType("text/html");
response.getWriter().write("HELLO");
return (mapping.findForward("success"));
}
}
I want "HELLO" should be displayed after returning from server side
code.
But i am getting entire jsp page.
Why ?
Please help
Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---