I am using the Spring MVC framework to create a website. One of the features that I will need to have is the ability to upload a folder.
However, by only using Spring, I can only upload a single file or multiple files. Alternatively, I can ask the user to create a ZIP of the folder to upload, but this would be their responsibility to do that.
Is there a way to, within HTML, select a particular folder? Is there any way to copy that entire folder to a server?
you can use spring multifile feature to upload multiple file.
please refer given link , may help you to solve your problem.
http://howtodoinjava.com/spring/spring-mvc/spring-mvc-multi-file-upload-example/
Related
I am developing a website using angular6 and spring boot with microservice architecture.
I have got the UI from designer team in the form of HTML, CSS, and JS file, whose structure is attached here HTML and CSS files
Also, I had created a angular6 project named DIS, whose structure is attached here Angular6 project
What will be the best way to start with angular 6?
How to include these files in angular6 project considering microservices architecture?
If i understood your question correctly.Yes you can do that.
Step 1: You need to create the Necessary components, Modules needed to build your website.
Step 2: Replace the components with the necessary HTML file and CSS file. As you generate a component with CLI you should have those 2 files just replace them.
When you have global CSS files that can be shared among other files as well. You can configure using Angular CLI.
Regards to microservices architecture, that does not have anything to do with your front end applicaiton, its totally on the server side. But you can consider while creating the components based on the services you have.
ng new ng6-proj --style=scss --routing
Just make changes in the main style.scss that will apply globally.
Images you can keep it anywhere, you just need to use it by providing its path
I have some questions about Wildfly deployment
1.An ear, when deployed in wildfly, is extracted within standalone/tmp/vfs/deployment/ directory. Can I place a file there manually and still access it from web. (I can check it, but as of now I do not have any machine to test it).
Can I create a file and place it there via some program. The reason I am asking this question is that I need to generate some files based on user input and provide the user with a link to that file. One way to do this is to statically link a directory in JBOSS and create the file there(access it using file handlers see this). I just want to know if it can be done at all using something like VFS.
If you need to persist to a file you'd want to create a new file handler, like the link you provided describes, and write the file to that folder. You don't want to try to use that temporary deployment directory. The content is not exploded by default so writing to it would likely fail.
If you don't need to persist to a file you can just use an output stream of some sort and the user will be able to download the file.
I'm creating a dynamic web project in eclipse using jsps and java servlets, however I want to add some external files to be edited using the app. Where do I put them such that I can open them from my app and save an edited version - and finally provide a link for a download of the edited file?
Thanks
Where do I put them
Nobody cares. Really. As long as it's not in the deploy folder, of course.
If your concrete problem is avoiding to hardcode the exact external location in Java source code, just provide it as VM argument, environment variable, properties file setting, or whatever externally configurable. For detail, see also Recommended way to save uploaded files in a servlet application.
And/or if your concrete problem is serving those files back to the web, just either tell the server to publish the external location into the web as well, or create a servlet which reads from the external location and writes to the response. For detail, see also Load images from outside of webapps / webcontext / deploy folder using <h:graphicImage> or <img> tag.
I need to make a link in my Java Spring application that will allow the user to download a CSV file . I have the CSV file in my project's root directory and I have an tag in my view that runs a Javascript function when it's clicked. Is there any way I can use either Javascript or the Java Spring framework to allow the user to download the CSV file? I'm a noob Spring user/developer so any help is appreciated. :)
Put the file in your WebContent (or whatever you call the web resources directory) and link it directly. Everything below WebContent (but not in WEB-INF) is accessible in your context root.
So file WebContent/test.csv is accesible with relative url /test.csv.
I'm trying to create an RSS file for access online. I already have a dynamic web project running with a servlet and several EJB's for business logic. All I want to add now is a way to create the RSS file. I haven't found good examples online. And I'd like to write it myself anyway. Does anyone know of a way to write to an existing web file that's in the WebContent folder?
I have created a "status.rss" file in the WebContent folder containing preloaded xml. I have accessed it through a browser. Now I just need to reference it in my EJB and modify the content. I'm not sure how to reference the file and the methods to call to write text/xml to it.
Do you use XMLstreamwriter, print statements, etc?
We should not be doing this from the EJB to write the data to files, however you should consider other alternatives. As transactions should not get congested.
If your model data to xml is simple , this xml api will help you to achieve that to output XML.
Also you can implement this via a servlet to pull the data.
http://x-stream.github.io/
On why you should not create file from the EJB tier, please see this design document.
Java blue prints on EJB tier/container restrictions.
http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html