Jump to content

Open, Edit & Save XML file on JSP


Guest 4everTYC

Recommended Posts

Guest 4everTYC

Hi, I wish to allow user to search from their PC directories, open, edit & save the XML or any text file from a JSP.Once the user selected the document, it will be shown in a textarea kind of field where by the user can edit the file & save it after that.Anyone know? Please help me as I really cant find any code to do that. Thanks alot.

Link to comment
Share on other sites

If you plan on doing this through a browser, you're most likely going to have to use an <input type="file" /> element in your form to allow the visitor to upload a file to your server. This is the only way that I know of to allow a visitor to browse files on his/her computer.Then, once the file is uploaded (i.e. the form is submitted), you'll have to open it and render the contents to the textarea. This would require a round trip from the client to the server and back.To ease page loading, you might consider an AJAX solution. You could capture an onchange event for the <input type="file" /> which could automatically attempt to POST the file to your server. Then the response could be the text value of the file which you could use the HTML DOM to change the value of the textarea.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...