Sounds like a problem in your server-side code (ie. your jsp).  The
"responseText" property of an XmlHttpRequest just "Retrieves the
response body as a string." (from MSDN).  So, the reason you're seeing
the entire jsp is because you're returning the entire jsp :-)

If you're working in the jsp world, you may want to take a look at
JSON-RPC; it's a Java servlet that makes it relatively easy to
serialize Java classes in to JSON (and it can be adapted to work with
Mochikit.Async with only a little hacking).

Jeremy

On Jan 21, 1:48 am, Prashant <[EMAIL PROTECTED]> wrote:
> 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 mochikit@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to