Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Sample JSP code to create a folder

Posted on 2003-11-27
Medium Priority
Last Modified: 2011-10-03
Dear Experts,

       I am facing a problem on how to create a folder by using JSP code. Can you please give me a hint on this? Thank you.

Question by:jocelynyip
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 35

Expert Comment

ID: 9830668
  File f = new File( "/path/to/folder/you/want" ) ;
  f.mkdirs() ;
LVL 35

Accepted Solution

TimYates earned 150 total points
ID: 9830689

 <% f = new "/path/to/folder/you/want" ) ;
  out.println( f.mkdirs() ? "Folder created" : "Create failed!" ) ;
LVL 15

Expert Comment

ID: 9830704
Or for those of us who despise the ?: operator and prefer readability ;-)

<% f = new "/path/to/folder/you/want" ) ;
  if (f.mkdirs())
    out.println("Folder created");
    out.println("Create failed!") ;

(It does the same thing, give Tim the points ;-))
LVL 35

Expert Comment

ID: 9830750
>  Or for those of us who despise the ?: operator and prefer readability ;-)

Hehehehe....that was a simple one ;-)  the perfect case for the "?" operator :-)

it's when you start nesting them that readability becomes an issue...

    int i = (int)( Math.random() * 5 ) ;
    out.println( "i is " + ( i == 0 ? "zero" : i == 1 ? "one" : i == 2 ? "two" : i == 3 ? "three" : i == 4 ? "four" : "bigger than four" ) ) ;

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question