This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 12675
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.

Java Resources at
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
Consider Paul's rocket mass heater.
subject: Question for experts?
Similar Threads
Bean or Servlet or JSP?
should I use transaction for this scenario ?
parsing in servlet
Re: Servlet Navigation Problem
is it possible to make a servlet to a webservice?