Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to implement a cancel search?

Status
Not open for further replies.

RexHeadlong

Programmer
Apr 10, 2002
35
US
Hi, all.
I've got about 2 months experience with JSP, so bear with me. I'm sure this has been done before. I can't find any good clues as to how to do it though.

I'm using JSP with Struts. I'm trying to implement a database search, where you can cancel the search at any time before the results page appears.

I have an API to my database that supports search cancellation, I just need to figure out how to do the rest of it. At this point, I don't care if it all happens in a single window, or if the search occurs in one window while the cancel button appears in a separate window.

Any ideas out there? Thanks for any help.
 
If your search mechanism provides the capability you describe i would think you could place the object that has the cancel() method in the session and then if the user clicks cancel in the browser window your server code would retrieve the object from the session and call the cancel method. Obviously i have no way to prove that theory.

-pete
 
Thanks for the reply. I actually have a semi-working solution, but I've still got one problem.

I'm currently trying a two-window solution. The main window has a Search button. When the user clicks on the Search button, I do a window.open(...) to open a subwindow that contains a Cancel button. I also submit the actual search back in the main window. Clicking the Cancel button has the effect of cancelling the actual search and closing the subwindow, so that's not a problem. The problem is that if the user does not cancel the search, and waits for the results to appear in the main window, then I lose the handle to the subwindow object that I need to close the subwindow.

I have possibly 2 problems to overcome: How to preserve the subwindow object handle, and how to convince the subwindow that the results page has the permission to close it.

I'm not allowed to use frames, so I'm not sure if this will be possible.

Any ideas? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top