0

I am working on a Spring-MVC project. Currently I have a few classes in order and I can save the information in database and retrieve it. I now have a website template in HTML, CSS, JS, images. I would like to pull this template into my spring project. Structure is as follows. I would like to know in which order I should create the directories and where to place them, so references will be parsed without error.

Structure :

webapp/
|--resources/
| 
|+-WEB-INF/
          +--web.xml
  +--classes/
  +--spring/
     |+--root-context.xml
     |+--appServlet/
         |+--servlet-context.xml
  +--views/
          user.jsp

The template I am using has this format of referencing information

img/products/name_of_image.jpg
<a href="contact.html"/>
css/css-filename.css
js/js_filename.js

The user.jsp is the landing page and I have already put the HTML code for home inside it. I would just like to know how to structure the directories so I can directly put all those files and the template will work. Thank you for your time.

We are Borg
  • 5,117
  • 17
  • 102
  • 225
  • Have you add any link to the `controller` or `web.xml` because think it goes to backend and how MVC knows that this request is for... – Arpit Srivastava Sep 23 '14 at 08:49
  • Yes, For example, when I want to add an user, there is a Requestmapping in controller for /user/add. I will make the necessary changes to template as required, but I must know how to integrate it. Point is to save writing all the HTML, CSS and JS code. – We are Borg Sep 23 '14 at 08:57
  • I didn't get you....as per my understanding you able to access controller but can't server HTML file from controller – Arpit Srivastava Sep 24 '14 at 07:28
  • There is html code within my JSP file, the controller has Requestmapping like /user/add. So within html file, I call action /user/add, and it works. But my CSS and images which are inside the project cannot be found when the application is loaded. – We are Borg Sep 24 '14 at 07:54
  • you have to add path for static also in web.xml file.....http://stackoverflow.com/questions/870150/how-to-access-static-resources-when-using-default-servlet – Arpit Srivastava Sep 24 '14 at 08:37

0 Answers0