• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Struts: search page functionality

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm working on a web app making use of Struts 1.1 and JSTL 1.0. One of my tasks is to
implement a search form that will display search results. A search result is basically a file stored in a database. These search results have to offer two additional user actions each: a link for downloading the specific file (the search results contain the files DB id) and a user-specific link to delete the file. The search and display logic is more or less done (the search results are put in request in search action). I do have a problem with something I'd call standard behavior at search pages: if a user chooses to delete a file (I intend to offer an action for this) I think it is standard to show the result list afterwards again. This means that I have to re-run the search again and I need access to the search form search values. Right now I do something like this:



This snippet is inside the search form tags, by the way. The problem is that the only value I can access in the appropriate "DeleteAction" is the protocolId, not the search form's values, so I can't re-run the search. The basic problem is the very same if the user hits the download link leading to a download action: when the download action is done the search results are gone. I am very grateful if you can give me tips and hints for this.

By the way, are there special Struts/JSTL tags for downloads?

PS: couldn't check the FAQ because it's under maintenance

[ October 12, 2007: Message edited by: Mike Himstead ]

[ October 12, 2007: Message edited by: Mike Himstead ]
[ October 12, 2007: Message edited by: Mike Himstead ]
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although it can be somwhat complex and time consuming, one solution that I believe could be useful here is Ajax/Javascript.

Once the delete Action takes place, call an event that will submit a request to the SearchAction asynchronously then update the display with the results.

Might not be the best approach, but it seems to be more and more common these days. I've been reading up on it recently.

Hope it helps!
 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Populate a div with the search results. Then when you delete or make a change refresh the div.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have typically stored the form that has the search criteria values in the session. Then when you need to refresh the search page you can pull the form out of the session and rerun the same query. This help out with basic edit flow as well so you can rebuild the search results page after the user edits an item.

- Brent
 
Mike Himstead
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

thank you very much for your answers. Please allow to let me make additional comments:

- Ajax is no option because of lack of time, my own experience (the lack thereof) and project requirements.

- When you store the search results in the session the page will display search results when the user leaves the page and returns later on. The search form containing the search parameters is stored in request only and outside of the form, so the page would display results without parameters. A solution could be to put the search results inside the form and store the form in the session. So far I hesitated to populate the session with too much data, but I can't name specific reasons apart from a obscure fear of a possible performance bottleneck.

I experimented with three different actions (and Action classes) for searching, deleting and downloading, each class populating the same form. Could it be that one gets a new form instance for every action? After searching the form is completely empty when entering the downloading action.

Any more comments are welcome.
[ October 12, 2007: Message edited by: Mike Himstead ]
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic