I have a working applet on my Tomcat server but in this applet I need to save information locally.
I used writefile.. and it was working on eclipse, but it doesn't work like that on a server..
I did a lot of research to do a servlet to be able to save the information in an html file. I know I have to use a Post, but I don't know how.
I also want to know if the servlet is just a Servlet.class placed in my tomcat folder and how to call it from my java application?
First, I used writefile.. and it was working on eclipse, but it doesn't work like that on a server..
Continue using that. The applet will need to be digitally signed before it can be successfully deployed, so if it declares all-permissions in the manifest, it should be able to write to the local file system.
Related
I've coded a game in Eclipse (still working on it), is it possible to run it's jar file in browser so that anyone can play right from their browsers instead of downloading jar file?
I.e I upload it on my website so that anyone can play right from the link I provide them.
Consider using Java Web Start with JNLP. You can host a JNLP file on a web server somewhere, along with your jar, and users can use a desktop shortcut pointing to the link, or a browser to open your app. (Using a browser will require having a web page with an applet tag: the article mentions how to do this but doesn't separate the two.)
I am new in java web application, (Java EE, JSF).
I tried to change the contents of a csv file on the client computer with a java web application, so that the client does not have to download a new file, because the file is already in the set to be used for applications in the client. so I just wanted to rewrite the csv file.
Could it be done in java web application? If yes, please give me an example. I am very grateful if there is a better solution.
No, absolutely not. You can't change the contents of a file on a client computer from a web browser. The best you could do is have them upload a version of a file and then send them another version to download. Giving write access to the filesystem would be a massive security hole.
Place the CSV on a network share somewhere. The client can edit it, the back-end server can edit it. Requires more infrastructure, of course, but may work depending on the type of application.
Not that I think this is what you want, but if the 'client computer' was also acting as the server (i.e. was the host running Jetty/Tomcat/whatever), then you could modify files on it using the java IO api.
Again, very likely not what you want, just saying it would work.
I'm developing a JSP application, and I want to be able to upload the contents of a directory to the server. So the user will select the directory he wants to upload, and somehow all its contents will be uploaded.
Can't be done with regular HTML/Javascript, you have to use either Java or Flash.
There is no support for this in HTML (only uploading of a single file) so there is nothing you can do in your JSP. If you want to do this in java you will have to have something client side, like a signed Applet or a jar that the user downloads and runs.
Looks like it's time for a Framework! Struts2 can handle this type of jobs well and is easy to start with. Here you can take a look at a File Upload sample.
As said, there is no way to do this in JavaScript/HTML.
If you do not want to use a Java Applet (they are clunky and your users may not have Java installed), you can let people upload a zip file and extract it on the server (there is support for this in the Java standard API). Both Windows and Mac OS allow the clients to zip a folder by right-clicking.
i have a java based web application, i have the source code as well as the war file, the application uses mySql and need some web server like tomcat all to be added to some package that can be directly installed on window and linux machines directly..
i need to setup DB, WebServer, and app in one go. Would be great if it can create services for all as well.
is it possible???
i mean the user should just give the location to store and everything should get stored in one go, is it feasible? and if yes please guide me how to do so...
In short: Yes, it is.
Projects like XAMPP are already following that approach. All relevant software components are inside a single ZIP file which you can extract to an arbitrary location on the user's harddisk. All configuration then uses relative paths when referencing files.
So essentially, you will have to put in a little effort in advance to make the "installation" as easy as possible. Maybe you can simply build upon a project like XAMPP and use the infrastructure already provided?
after lots of investigations for calling a web service from silverlight:
Calling a Java Web service from silverlight throws an exception
I found out that I should I have to create a clientaccesspolicy.xml file and put it in the root folder of the application. I copied it in the root folder of my ASPX (web page) but it didn't help. I'm guessing the root folder should be the root folder of the server for my Java service. I have apache server on my Win7 x64 system but after stopping it the Java still worked so I'm guessing that the server for Eclipse IDE is different from Apache.
So the main question here is: Where is the root folder of Java Eclipse server? Where should I put that xml file?
Thanks.
If you are using a self-hosted Java webservice with Endpoint.publish(String) then I think it is not possible to add further files for delivery, e.g. a crossdomain.xml
Instead you need to switch from a self-hosted webservice to a server-hosted webservice as described here (the tutorial is using Netbeans, but a similar approach should be possible with Eclipse, too, even if it might be slightly easier to use Netbeans for this example). As Tomcat is used as a server, it is also possible to deliver the corresponding Silverlight project files as well, in which case you do not need a crossdomain.xml