Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP to JSP communication problem by using AJAX

 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I did an example on AJAX with Structs , when i send request from JSP to Action class i am able to get the req.responseXML object in the JSP.

Problem is: (In this example i am not using the Action class , directly from JSP i am calling another JSP with AJAX)When i am trying to send request from JSP to another JSP where i am producing the XML and flushed it. But in the first JSP i am not getting the responseXML object.

Sample Code used in 2nd JSP, where i am producing and returning the XML

response.setContentType("text/xml; charset=UTF-8");
response.setHeader("Cache-Control", "no-Cache");
//Here generated the XML in String Buffer (sb)
out.flush();
out.write(sb.toString);
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm no expert but if we have a look at the OutputStream it says

Flushes this output stream and forces any buffered output bytes to be written out


You call write after flush. Is this really the right way of doing this?
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mentioned the same code works good with Action class.

But if the same code written in the JSP it is not working.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic