File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes AJAX jsp response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX jsp response" Watch "AJAX jsp response" New topic

AJAX jsp response

Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
following is a JSP code responds to an AJAX script
everything seems to be ok, except for the output expected on the html page is supposed to be


but the following code:

gives the response:

"<% response.expires=-1; response.write("Hello"); %>"
[ January 20, 2008: Message edited by: Ashimashi Kabashi ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Is this a JSP page or an ASP page?
It looks like ASP to me.
Whatever it is, your server is treating it like plain text.

Can you tell us a little about how you're deploying it (what container, what file name, the location on your server, etc...)?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ashimashi Kabashi
Ranch Hand

Joined: Sep 11, 2006
Posts: 84
two files in CATALINA_HOME/webapps/abc/tmieAjax.html and

code for timeAjax.html is
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
First thing you should do is open up the page in the browser directly. If it does not run in the browser, than you know the issue is with your serverside code.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

OK, this code:

is not valid JSP code.
Again, the syntax looks like Microsoft ASP to me.
If this is in a file with a ".jsp" extension and in a valid Tocmat application, then there is something else wrong on your server as well.
It should be throwing exceptions when you try to run it with that code inside the scriptlet tags.

It looks like your problem in on the server side.
I agree. Here's the link:
subject: AJAX jsp response
It's not a secret anymore!