html5 - Spring 4 Switching from admin to admin/minor view causes resources not found -
the issue when switch admin admin/minor causes resources not found.
here controller :
package com.projc.spring.controllers;
import javax.servlet.http.httpservletrequest;
import org.apache.log4j.logmanager; import org.apache.log4j.logger; import org.springframework.beans.factory.annotation.autowired; import org.springframework.context.messagesource; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.servlet.modelandview; @controller public class admincontroller { private static final logger logger = logmanager.getlogger(admincontroller.class); @autowired private messagesource messagesource; @requestmapping(value = { "/admin" }, method = requestmethod.get) public modelandview index(httpservletrequest request) { logger.debug("admin index page"); modelandview model = new modelandview(); model.setviewname("admin/index"); return model; } @requestmapping(value = { "/admin/minor" }, method = requestmethod.get) public modelandview minor(httpservletrequest request) { logger.debug("index page"); modelandview model = new modelandview(); model.setviewname("admin/minor"); return model; } } in index.html have menu links :
<a href="admin"><i class="fa fa-th-large"></i> <span class="nav-label">main view</span></a> <a href="admin/minor"><i class="fa fa-th-large"></i> <span class="nav-label">minor view</span> </a> the first link works fine click on second loads page without css, js...since have resources not found.
it's /admin/minor appended /admin
for example jquery file referred
http://localhost:8080/mintad/admin/admin/js/jquery-2.1.1.js which has
http://localhost:8080/mintad/admin/js/jquery-2.1.1.js i want make website users , 1 adminitrator respective urls : website_url , website_url/admin
i may thing wrong. please help
the solution use thymeleaf layout.it means use template refer each resource th:src or th:href please check thymeleaf tutorial see how.
Comments
Post a Comment