Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: java servlet related

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation java servlet related

    Hello,
    I am trying to write code for saving a pdf, or other files ( thru a Web page by a client ) . The file are stored on the server side ( in C drive ).
    The path for these files are saved in database. I have written a servlet that opens the file in a new window directly. But for now I am working on a same machine ( as client and server). Want to know if this same code will work for real server- client model.
    Any help would be of great use.
    Thanks.
    part of code:

    File pdfFile = new File(ab); // ab is the path retrieved from database.

    if (pdfFile.exists())
    {
    if (Desktop.isDesktopSupported())
    {
    Desktop.getDesktop().open(pdfFile);

    } else
    {
    System.out.println("Awt Desktop is not supported!");
    }

    } else
    {
    System.out.println("File is not exists!");
    }
    Last edited by vidi; April 16th, 2011 at 11:29 PM.


Similar Threads

  1. collecting information/moving from servlet to servlet
    By CBird in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 1st, 2011, 07:04 PM
  2. Running servlet from java project
    By raj07 in forum Java Servlet
    Replies: 1
    Last Post: February 19th, 2011, 07:11 PM
  3. Java servlet read file
    By peliukasss in forum Java Servlet
    Replies: 0
    Last Post: April 15th, 2010, 08:02 PM
  4. What is SNMP in Java?Hoe to execute code related to this?
    By jj_crazy_1 in forum Java Theory & Questions
    Replies: 0
    Last Post: April 5th, 2010, 11:47 PM
  5. Related to Html and Java Script?
    By JackyRock in forum JavaServer Pages: JSP & JSTL
    Replies: 2
    Last Post: February 17th, 2010, 03:10 AM