how to create and append date to xml file through ajax - ajax

Some part of chat app is over, well Im able to read from an xml file using Ajax but how do i write to an xml file through Ajax? Does Ajax support file modes? I want to create xml file if it does not exist and append some data to it if it exists.
I have used Post method but Im unable to solve it Please someone let me know how to create and append data to an xml file through ajax.Thanks

ajax is a technology used by client. So it is obviously not possible to edit file on server

Related

how to handle Multiple file upload using spring

I am a newbie to spring and mvc framework.
I am going through the framwork and i wanted to understand the File upload (multiple) and use spring to load my complex object.
I have seen example using MultiPartFile for single file upload.
I tried the same for trying out the multiple file upload but I failed where i tried to make generic (like allowing the user to upload as many files).
Is there a way to do it in a optimal way to have the files available as list in the controller?
Thank you for reading!!!
is there a way to handle this without using multipart resolver?
Take a look at my answer to a similar question here:
Preserving value for <form:input type="file"> with Spring MVC
This explains our approach of an asynchronous file upload handling and processing of them on a final form submit.
I have used jquery.form.js. You can find example using Google. If not you can tell me to post a link. Moreover you should investigate how the browsers will handle the upload process (i.e.

asp.net mvc create csv file in memory without creating a physical file and send email as attachment

I'm working on asp.net mvc web application development, where I need to create a CSV file in-memory and send as attachment of email.
I had a look at this stack overflow solution below:
Export C# List to Csv file
Unfortunately, this solution returns File Result and doesn't fit with my requirement.
Any help will be much appreciated.

Create complex HTML file in JAVA

I'm using spring 3.1 and I need to create HTML file.
But it's not for the usuall 'request-response' job.
I have to do this at Spring startup.
Which means it's should done in JAVA, right? Because it' not triggered by http request.
And the HTML is not simple. It has a complex DOM structure to display data retrieved from DB.
It would be very tough to create html code in java(hundreads of out.println();).
Is there any easy and neat way to create complex HTML in java?
For example.. (it's my imagination)
In java(my ApplicationLisener), retrieve a data and store them somewhere.
In jsp, create html with the data and send the html code back to java.
In java, create html file and place it somewhere.
I hope similar things are possible.

Upload pdf on a server with Spring MVC

i try to create a web site where it will provide an option to the user to upload a pdf file. I want this pdf to be saved on the server with specific url. For example:
The user select the title.
The user upload the file.
I want after these actions the file to be accessible via a specific url/name_the_user_give.
I saw that the Spring MVC provides very easy interface for file uploading.I already see many tutorial about this but my problem is how can i save the paper into a server.Also i want the pdf to open by the browser's tools.Can anyone give me directions?
To save the file on server path you simply needs to write the file stream to the path described by
request.getServletContext().getRealPath("your directory name here");
and then create the file using the real path you get.
And to show the pdf file using browser plugin, you should use following in your controller method.
#RequestMapping(value="url to map", produces={"application/pdf"})
Hope this helps you.
Cheers.

Ajax using Prototype.js in OFBiz

I need to make an Ajax call inside OFBiz framework using prototype.js. I am doing that from a .ftl file. I am confused about how to handle the server side - through Java event or Java service? What is the best practice? And also I am having problems making the framework recognize the prototype.js file. There is some issue with the path name in the script tag. It has to be some peculiar naming as per OFBiz framework standards.
I searched Google but I only found links on how to use prototype but none on the combination of prototype + OFBiz. If anybody has done anything in OFBiz like this, please help.
The server process the AJAX request just like any other request. It may contain an event or not, and the response your js function will get is the HTML output ( if the response is a view ). If you want to use JSON, you must create an event with type="jsonservice" ( and you must include the jsonservice handler in your controller file ). This way you can send and receive data structures using AJAX.

Resources