aspose file tools*
The moose likes Servlets and the fly likes Is xmlhttprequest differnt from httprequest from a servlet prespective? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Is xmlhttprequest differnt from httprequest from a servlet prespective?" Watch "Is xmlhttprequest differnt from httprequest from a servlet prespective?" New topic
Author

Is xmlhttprequest differnt from httprequest from a servlet prespective?

John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39
Hello ranchers,
I am using ajax in my web application, when a xmlhttp get request is sent, insdide the doGet method, is there any difference how the httpServletRequest object behaves? Can i acess session etc from the servlet when the request is xmlhttprequest?

Any response would be appreciated,
[ October 12, 2008: Message edited by: John Robert ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
No

Xmlhttprequest is a browser/javascript side concept.

The server just sees a normal httprequest to be processed like any other GET or POST. I suspect that the request headers may have extra significance but it is up to you the programmer to check those headers.

Bill
John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39
Bill thanks for the response . I have a list that needs to be displayed on the page dynamically, using ajax. So i wanted to put it in session scope, so was thinking will i be able to do access session scope from the servlet on a xmlhttprequest.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Yes. As was already pointed out, the fact that the request was initiated as an Ajax request is transparent to the server.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Robert
Ranch Hand

Joined: Jun 17, 2008
Posts: 39
Yes. As was already pointed out, the fact that the request was initiated as an Ajax request is transparent to the server


Bear, I was just trying to explain what i was trying to do.I did understand that i will be able to do that from Bills response. Probably should have phrased it differently . Thanks anyways.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

OK, cool. Sounded like a question and I wanted to make sure things were clear.

For some reason, a lot of people out there think that you can't use Ajax in conjunction with Servlets and JSP and that, of course, is complete nonsense.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is xmlhttprequest differnt from httprequest from a servlet prespective?