jsp - The file download folder view in Struts -


i'm creating project of school. want show uploaded stuff teachers students. need save file in folder named faculty name. student able browse main directory , after can go in particular faculties folder.

how can it? suggestions appreciated.

for file upload start example in this answer. moving files temporary folder done file uploading action.

for browsing files in case create action able navigate folder files , list of files folder. this

string file = application.getrealpath("/upload"); file f = new file(file); string [] filenames = f.list(); file [] fileobjects= f.listfiles(); (int = 0; < fileobjects.length; i++) { if(!fileobjects[i].isdirectory()){     string fname = file+filenames[i];     out.println(filenames[i]);  } } 

then map files jsp links. when link clicked can retrieve actual path on server when action executed. data, of course can return stream result action used streaming client browser. can use docs examples struts site or in this example.

to navigate folder use parameters in get request, used store current directory in session. can change if user change current directory view layer.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -