jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Question for experts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Question for experts?" Watch "Question for experts?" New topic

Question for experts?

Liz Cheyney

Joined: Oct 29, 2002
Posts: 1
I was wondering if there is any way to send HTTP request to the servlet as a background process.
I should probably clarify what I mean:
I have web application with several tabs for entering data and a user can navigate between them without submitting the data in the servlet/EJB/DB. At some point of data entering process I want to execute a query but I want it to be transperent for the user. In particular, I don't want him to see how the page is refreshing and so on. Can I do it?
Thanks in advance
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
I'm not sure if this is what you mean, but you can use JavaScript to send a request to a servlet, placing the response in an off-screen frame and then acting on that data with JavaScript. The screen the user is looking at is not affected.
Jesse Beaumont
Ranch Hand

Joined: May 30, 2002
Posts: 43
Yes you can but it gets a bit messier. The way to do it is to put your page in a two frame frameset. The first frame contains your page, the second frame is of size 0. When you want to do the invisible submit you submit the data via the second frame and include an onLoad event in the response which populates the data back into the first frame. The problem is that all your javascript get's that much messier because you are using frameset's but from the users perspective it is the neatest way to do it. The only other thing to keep in mind is that when the user actions a request like this there is no feedback to the user that an action has taken place.

---<br />Time flies like an arrow,<br />Fruit flies like a banana
I agree. Here's the link: http://aspose.com/file-tools
subject: Question for experts?
It's not a secret anymore!