This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Sir,I have to upload the logo image.Can you explain where on the server should i transfer the file to.Suggest me the folder i have to upload it to.I was thinking resources folder in the WEB-INF is a better place.
Inside the WEB-INF isn't the best place for an image unless you need to protect regular access to them - regular images need to be somewhere net accessible, and WEB-INF is a "private" location for your web-app. You'd need a servlet to "front" your images if you stored them under WEB-INF (i.e. get the request, map the request to an image stored under WEB-INF, return the binary contents of the image from the servlet). If you store them in the web root of the web application, or in an accessible sub-folder, you can use them like regular images in your webapp.
Joined: Aug 31, 2007
Sir,Can you explain it in a more detailed fashion. I could not get the gist of it.Did you mean some other folder outside the webapps folder. What difference does it make if the images are outside the webapps folder inside (the resources folder inside the webapps). My dir structure is like this: tomcat->webapps->WEB-INF, resources->images->logos.jpg. Do i have to change this logos.jpg directly(i am replacing this file by another file with the same name) or do i have to link it to some other folder outside the webapps folder. Kindly explain. Thanks for the help Sir.
For web applications, construct a form with input type="file" in your jsp. create your controller to extend abstract controller then use something like this: MultipartResolver resolver = new CommonsMultipartResolver(); MultipartHttpServletRequest request= resolver.resolveMultipart(httpRequest); MultipartFile file=request.getFile("your file id from hte form"); [ December 23, 2008: Message edited by: Nick Potter ]