wood burning stoves 2.0*
The moose likes Struts and the fly likes File Chooser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "File Chooser" Watch "File Chooser" New topic
Author

File Chooser

pamir sonmez
Ranch Hand

Joined: May 31, 2010
Posts: 46
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

Joined: Sep 29, 2008
Posts: 12617

Are you trying to use Swing components in a web app?!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Which "file" is this which the user is saving? Is it an upload or a download?
pamir sonmez
Ranch Hand

Joined: May 31, 2010
Posts: 46
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

Joined: Sep 29, 2008
Posts: 12617

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Chooser
 
Similar Threads
Downloading Excel File
force download of page
GUI Design
JFileChooser opendialog question
JFileChooser problem