File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to filter ajax response and display in jsp page

 
rajeev panigrahi
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I called jsp page from html page using jquery and ajax which is working properly but the response it displaing is a html code .see below.I have entered 1 and 3 and the sum of the two number shold display 4.but in the result it is displaying the complete html code with result.how to avoid it...........


first number: 1
second number: 3
result: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body>4</body></html>

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you trying to use a .jsp page to perform a calculation? :confused:

JSP pages just naturally write all that HTML stuff you don't want to see. Instead, use a servlet for the computation, that way you totally control the returned text.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:JSP pages just naturally write all that HTML stuff you don't want to see.


Sorry, but that is not correct. A JSP will return only what is in its template. It does not naturally generate any HTML.

To the OP, if all you want to return is "4", that's all that should be in the response.

And yes, why a JSP?
 
rajeev panigrahi
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:Why are you trying to use a .jsp page to perform a calculation? :confused:

JSP pages just naturally write all that HTML stuff you don't want to see. Instead, use a servlet for the computation, that way you totally control the returned text.

Bill


I tried with servlet that also giving the same response..........do you have any other solution
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you writing to the response in the servlet?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic