java - Accessing Resources from JSP inside WEB-INF -


i'm having trouble accessing images , css file jsp stored in web-inf. servlet calls jsp , loads fine page unable find images , css file. i'm new sort of thing , appreciate help. aware there have been questions on in past , i've tried suggestions posed can't seem head around it. here's contents of jsp (i tried bunch of different methods):

<%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd">  <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>title</title> <link rel="stylesheet" type="text/css" href="resources/grid.css">    </head> <body>   <!-- main container --> <div class="container_12"></div>  <!-- foreground container --> <div class="grid_10 prefix_1 suffix_1">      <img src = "/resources/images/foreground.png">  </div>  <!-- header container --> <div class = "grid 8 prefix_2 suffix_2">      <img src = "${pagecontext.request.contextpath}/resources/images/header.png">     <p>test</p>  </div>  <div class = "clear"></div>  <!-- navigation bar container --> <div class = "grid 8 prefix_2 suffix_2">      <img src = "${pagecontext.request.contextpath}/resources/images/navbar.png">  </div>   </body>  </html> 

and here's directory structure:

http://gyazo.com/0a7aea0a44e51e1789c263767e14a40b

you can use below find real path of image.

<!-- header container --> <div class = "grid 8 prefix_2 suffix_2">      <img src = "<%= application.getrealpath("/resources/images/header.png") %>">     <p>test</p>  </div> 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -