Results 1 to 4 of 4
  1. #1
    tskarthic is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default updating server side file using java bean

    Hello Friend,

    I have written one web application. A jsp file getting the inputs from html form and send to java bean. In Java Bean, the input values are updated or inserted into the file which is residing in the same web server.

    But it is failed to find the file name and gives the "FileNotFoundException" error.

    Filename which has to be updated mentioned like below in the java bean code.

    Please find the attachments for code.


    Please Help me out.

    rgds
    tskarthikeyan

    [QUOTE]
    Err Msg:
    java.io.FileNotFoundException
    : http:\localhost:8081\FileHandle\CMCINFOPAGE.html (The filename, directory name, or volume label syntax is incorrect)
    Attached Files Attached Files

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    802
    Rep Power
    6

    Default

    Hi Karthic,
    U should not give the site URL path.Give the exact path where ur file is residing.It will not give error.

    Example :
    I have copied ur attachment file in my system and worked like this
    File inFile1 = new File(
    "D:/Tool/Tomcat 6.0/webapps/FileHandle/CMCINFOPAGE.html");
    File outFile = new File(
    "D:/Tool/Tomcat 6.0/webapps/FileHandle/CMCINFOPAGE1.html");

  3. #3
    tskarthic is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default Update Server side file using URL Connection

    hi ramya,

    we can update the server side file using java URL Connection. See the attached code snippet for more info:

    But this program is not updating the specified file(Testing.txt).
    Also no errors coming.

    Please have a look on this attached code and give your idea.
    Attached Files Attached Files

  4. #4
    tskarthic is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by RamyaSivakanth View Post
    Hi Karthic,
    U should not give the site URL path.Give the exact path where ur file is residing.It will not give error.

    Example :
    I have copied ur attachment file in my system and worked like this
    File inFile1 = new File(
    "D:/Tool/Tomcat 6.0/webapps/FileHandle/CMCINFOPAGE.html");
    File outFile = new File(
    "D:/Tool/Tomcat 6.0/webapps/FileHandle/CMCINFOPAGE1.html");
    Hi ramya,

    We can give like what you suggested here.
    You mean we can give the webserver absolute file path. But i dont know if it is working fine. Have you tried this before?


    But we can do this using java URLConnection. I have see some samples in the internet. But it is not updating the server side file.

    If we execute this code, then it is showing the old content of the file only. it is not show the new content of the file. also no errors are shown in the console.

Similar Threads

  1. Replies: 2
    Last Post: 06-07-2012, 09:07 PM
  2. How to open a file located in server from client side
    By Malathi in forum Web Frameworks
    Replies: 4
    Last Post: 04-20-2009, 09:10 PM
  3. Replies: 1
    Last Post: 03-27-2009, 10:18 AM
  4. Need to change cursor to hourglass at server side
    By bgupta in forum Java Servlet
    Replies: 0
    Last Post: 02-16-2009, 07:35 AM
  5. Replies: 2
    Last Post: 10-05-2008, 06:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •