0

The structure looks like -

projectroot -- src --> main-->java-->com-->controllers etc
            -- src --> resourcess--> myresources --> css-->.css
            -- src --> resourcess--> myresources --> images-->.jpg etc
            -- src --> webapp --> mvc-dispatcher-servlet.xml
            -- src --> webapp --> pages --> .jsp pages

Top of the page contains -

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>
<html>
<head>

I am using following in head section of page -

<link
    href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"
    rel="stylesheet">
<link
    href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"
    rel="stylesheet">
<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet">

Images like -

<img    src="/resources/images/logo2.png" height=20;></a>

mvc-dispacther-servlet contains -

<bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/pages/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

    <mvc:resources mapping="/resources/**" location="/resources/myresources/" />
    <mvc:annotation-driven />

There is no error in console as such, but I don't see page being displayed properly. Any suggestions as why images and css aren't getting uploaded? Isn't mvc-dispatcher mapping for resources not correct as per my project directory structure? Thanks for any help on this.

1 Answer 1

0

Move your resources folder under webapp like this:

projectroot -- src --> main-->java-->com-->controllers etc
            -- src --> webapp --> mvc-dispatcher-servlet.xml
            -- src --> webapp --> pages --> .jsp pages
            -- src --> webapp --> resources--> myresources --> css-->.css
            -- src --> webapp --> resources--> myresources --> images-->.jpg etc
Sign up to request clarification or add additional context in comments.

2 Comments

worked like a charm. Just wondering what the default resources folder is used for. Thanks a lot.
found this one very helping - here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.