Reputation: 740
I'm a javascript webapp programmer, know java SE but not much of java web development.
When I do js development, I write codes like:
$.ajax({
url: "http://domain/abc.xml",
}).done(function ( data ) {
//todo
}
});
taking it granted that HTTP server will handle my Ajax request without any of my effort.
But now I have some js codes with Ajax requests, and I have to map the resources name on the server side. For example, when I request abc.xml, the server should respond with def.xml, mapping abc.xml -> def.xml.
So I guess I should write a servlet (have to use java) on the server side, override methods like doGet(). Any example to start with? Thanks a lot!
Upvotes: 0
Views: 1740
Reputation: 24493
The magic of ajax is all client-side. As far as the server is concerned, you are requesting the main page, and then some time later you're requesting http://domain/abc.xml
.
The server doesn't need to understand that the request has anything to do with ajax. Any simple servlet example will suffice.
Upvotes: 1