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

Passing data between pages/requests - Best practice

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to write an uplaod feature for my web-app.

I've managed to get the upload part working and am now trying to tidy up the management side of things, i.e. storing the uploaded file to the right location.

Basiacally I have a browse page which allows navigation through a folder/file structure, I present a link on accessable folders to the user to do the upload which navigates them (using a forward action) to the upload page where they choose the file and click 'upload' (MyUploadAction with a form-bean property org.apache.struts.upload.FormFile).

What I want to be able to do is pass the path from the browse page through the upload page to the upload action so it an work out which folder to store the file.

I can imagine two ways of doing this, although they might not be possible, or considered good solutions:

1) Packing.unpacking value into request/response:

The Browse page could somhow set a new request parameter for the path. although I wouldn't have thought the ForwardAction would preserve this value and pass it back out to the upload page? if it did/could do then we may be able to pack it into the form when the upload page is submitted.

- This approach feels a little low-level and would probably require writing javascript or such like in the JSP.

2) A second action:

An Action class could be provided which handles storing the path when the user clicks on upload from the browse page. This would (somhow - session bean) store the path which the MyUploadAction could pick up on when the upload is submitted.

- This approach feels more defined, but would result in more Actions to maintain.


Any guidance on which, if any of these approaches is the recomended route would be appreciate, or any other solution.

Thank you.
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic