在我的 webconfig.java :
中<?
$optarray = explode("<br>", $getreq);
foreach($optarray as $optval){ ?>
<option><?= echo $optval; ?></option>
<? } ?>
和在我看来我正在调用这样的资源[在' index.html ']中:
@Bean
public InternalResourceViewResolver internalResourceViewResolver() {
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".html");
return resolver;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**")
.addResourceLocations("/WEB-INF/resources/");
}
但是资源没有加载,我得到 <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/lib/angular-toastr.css" >
我正在使用我的控制器访问我的索引页面:
Failed to load resource: the server responded with a status of 404 (Not Found)
索引页的网址为:@RequestMapping("/myShellPage")
public String ShellPage() {
return "index";
}
产生错误的资源的网址为:http://localhost:8080/gestionprojet/transtu/myShellPage?#/
任何帮助将不胜感激。谢谢
答案 0 :(得分:0)
试试这个应该有效
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/resources/**")
.addResourceLocations("(/resources/");
}
静态资源
<link href="<c:url value="/resources/lib/angular-toastr.css" />" rel="stylesheet">