Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Chooser

 
pamir sonmez
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the action method of the application, I want to pop a menu browser and that user can choose the directory which he wan to save the file.

however, when i created the filedialog or jfilechooser, the filechoose browser stays behind the browser(firefox,IE)

How can I pop a filechoose browser and force user to select a directory.

Or something like that...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to use Swing components in a web app?!
 
Paul Clapham
Sheriff
Pie
Posts: 20769
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which "file" is this which the user is saving? Is it an upload or a download?
 
pamir sonmez
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, let me clarify to the situation

In the jsp page,

I submitted the button createReport and this method called the action method

public ActionForward createReport(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) {
....
....
In this method, I am creating a file, or I am writing some data to the file
After I finished writing, I want to pop-up a file dialog, save this file to the directory he want(like a simple file browser)
I used filedialog, jfilechooser but all showed the filebrowser dialog behind the internet browser
I want the user can see the file dialog front the internet browser
....

Meanwhile, I used to try response.getOutputStream() and writed data to the file
And a pop-up created "Save As", it worked perfectly up to now.
But After file is created, mapping does not work(return mapping.findforward(..))
Since response is submitted.
....
}

In this situation, I guess I am clear about what I want to do and I did up to now.
So, how can I handle this situation?

Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you certainly can't use a Swing component in a web application, and I'd recommend maybe learning a bit more about how web apps work, the request cycle, etc. You want to use a download servlet (countless examples available) or action.

As to why your forward isn't working, I have no idea, you don't really tell us much other than "it doesn't work". Please see ItDoesntWorkIsUseless and TellTheDetails.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic