0

i have a folder with images on webContent/images. I Just wanna to know how to provide this folder on the web.

In my project i have just one servlet with annotations:

@WebServlet(urlPatterns = { "/" })
public class IndexCtrl extends HttpServlet {

Every time i try to get a image this servlet get priority and send a index page. How can I provide images folder on the web? What I'm doing wrong?

RJuliao
  • 87
  • 2
  • 8
  • What do you mean with *provide this folder on the web*? – Luiggi Mendoza Feb 22 '13 at 20:50
  • what do you want exactly? show a jsp file a link labeled as the path of your images folder and then when you click on the link you can access to the images in that folder? What is the requirement exactly? – Marcelo Tataje Feb 22 '13 at 20:56
  • Possible duplicate: http://stackoverflow.com/questions/12397723/loading-images-css-javascript-in-a-jsp-java-ee-web-application – Nailgun Feb 22 '13 at 20:58

1 Answers1

1

Just don't map the servlet to /. That makes it the default servlet, which catches all the requests. Map it to the URL it must handle (like /index.html for example).

JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255