• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hold Form Data

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

I have a scenario where I have to get data from the database and show it in the listing format (Report). To achieve this I am getting data in the form of value objects, Holding that data in request scope and I am using <logic:iterate> to loop through the collection of valueobjects.

Below the listing I have a button called "Export" which should open a file save dialog box and enable user to save the report.

As I am holding data in the request scope, a new request will be started on click of Export button, I cannot access data from the Action class.

I don't want to get the data again from the database and I cannot hold data in session scope either.

Do Struts framework provide any functionality that I can make use of. How such scenario are handled in general.
Hope to see early replies.
Thank you very much in advance
Saritha
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, the ever-popular scenario which boils down to "I want to store in session but I don't"

Here are the options:
Store data in session
Save data as hidden fields in jsp
Write the data to a file
Make another call to backend
 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed. Looks like you're going to have to bite the bullet and put some data in the session (which isn't really all that bad if you make sure to clean-up every now and then).
 
Saritha Penumudi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you,

Ur replies where helpful and appreciated. I guess I will go with hidden fields. So that I don't have to worry abt cleaning up session.

I have one more scenario. I have a search criteria form. The user would setup some search criteria and clicks search, a listing page is shown with search criteria on top of the listing. Now, in the search method of Action class I have to reset the criteria to the form class inorder to show the selected criteria in my lisitng. How can I persist criteria selected without resetting same data to same form.

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

I am not getting whats the reason to call reset methjod in ur action class to persist the selection criteria.........If u have the form bean attached to the search screen then that will be populated ............so there is no need to call reset method right??
 
Saritha Penumudi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess my post is confusing.
I am not calling reset method. I was thinking of reassigning search criteria values to the form again in the action.

Sreenath, your right. I don't have to call either reset method or reassign form values. I did not implement above scenario practially. It was prepration for my coding.

I apologize for this. From now on, I will first implement and then post my queries.

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

One more question on struts framework
I have a menu from where I will click on a hyperlink which takes me to listing page. In my listing page I have checkbox before each record and delete button in the bottom of the listing.

Now, when user selects records from the listing and clicks delete button, I have to go and delete those records from the database.

on error, I have to show same listing with error message on top when I say return (mapping.getInputForward()); it is taking me to menu page. How can i get back to my listing page without getting whole data from the database again?

or it is compulsory to get whole records from database in both success and error conditions.

My question is why return (mapping.getInputForward()); is taking me to menu page

Please help me out.
Thank you
Saritha
 
reply
    Bookmark Topic Watch Topic
  • New Topic