I upload my project into a server.The files on the server are the following:
- index.jsp
- META-INF
- WEB-INF
When i have on the localhost the way that upload the pdf’s was:
try{
File file = new File("C:\\...\\pdf");
uploadItem.getFileData().transferTo(file);
}catch(Exception e){
System.out.println(e);
}
Now i’m using this:
request.getServletContext().getRealPath("/pdf");
But it doesn’t work.Does anyone knows how can i store the pdf’s into this file.And moreover if i want to retrieve a pdf file from this file what should i write?
I saw from this link: Upload pdf on a server with Spring MVC
That i should write:
@RequestMapping(value="url to map", produces={"application/pdf"})
“url to map” what exactly will be?Lets say that i’m having in the pdf file:mydocument.pdf.
That mean that i have to write:
@RequestMapping(value="pdf/mydocument.pdf", produces={"application/pdf"})
Is this ok?
Check out this example
http://www.roseindia.net/tutorial/spring/spring3/web/spring-3-mvc-fileupload-example.html