Well, a couple of things.
First, it looks as if you are still using scriptlets. Stop. Use the JSTL and EL.
Also, you are submitting directly to a
JSP. No good. Your first stop on any request should be a
servlet controller. In that controller you can fetch the information to display, in this case use file I/O to obtain the files and folder names, and forward to the JSP for display.
Perhaps
this article will help make that clear.