2016-12-30 12 views
1

최근에 내 애플리케이션을 Struts 2.5.8 및 Tiles 3.0.7로 업그레이드했습니다. 또한 스프링 v4.3.4로 업그레이드했지만 타일과 통합되지 않았습니다. 지금까지 오류없이 응용 프로그램을 올바르게 시작할 수 있습니다.Struts 2.5.8 및 Tiles 3.0.7 : JSP 페이지에서 img, css 및 js와 같은 리소스를로드 할 수 없습니다.

모든 struts.xmltiles.xml 파일이 올바르게로드되어 올바르게 렌더링되는 것을 볼 수 있습니다. 그러나 첫 번째 (로그인) 페이지를 열면 CSS, JS 및 webapp 디렉토리에있는 이미지와 같은 리소스를로드 할 수 없다는 것을 알 수 있습니다. 로그 파일 어디에도 오류가 표시되지 않습니다. Struts2에서

Error1: Unable to load any resource 
Not allowed to load local resource: file:///C:/Users/Public/Documents/FIXED/Rosy/JComponents/SALYExplorerWebApp/SALYExplorer/src/main/webapp/static/style/content.css 
localhost:8485/SALYExplorer/static/javascript/javascript.js Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/javascript/swap.js Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/javascript/SALYExplorer-layout.js Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/javascript/prototype.js Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/pictures/utils/print.gif Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/style/xtree_ext.js Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/style/xtree.css Failed to load resource: the server responded with a status of 404() 
localhost:8485/SALYExplorer/static/pictures/proximus.jpg Failed to load resource: the server responded with a status of 404() 
localhost/:26 Uncaught ReferenceError: set_table_display is not defined 
localhost:8485/SALYExplorer/static/style/xtree.css Failed to load resource: the server responded with a status of 404() 

F.e. 
Request URL:http://localhost:8080/SALYExplorer/static/javascript/prototype.js 
Request Method:GET 
Status Code:404 
Remote Address:[::1]:8080 
Response Headers 
view source 
Content-Language:en 
Content-Length:990 
Content-Type:text/html;charset=utf-8 
Date:Fri, 30 Dec 2016 18:17:39 GMT 
Request Headers 
view source 
Accept:*/* 
Accept-Encoding:gzip, deflate, sdch 
Accept-Language:en-US,en;q=0.8 
Connection:keep-alive 
Cookie:CONFIG=IU%3DYES%7CPA%3DYES%7CCA%3DYES%7CNA%3DYES%7CCN%3DYES%7CCI%3DYES%7CDI%3DYES%7CLI%3DYES%7CTI%3DYES%7CNI%3DYES%7CSI%3DYES%7CPM%3DYES%7CSU%3DYES%7CII%3DYES%7CVS%3DYES%7CVN%3DYES%7CSW%3DYES%7COS%3DYES; XTREE=28%3D1%7C39%3D1%7C89%3D1%7C31%3D1; username=id829957; logService=RRO_TEST; language=EN; authMethod=AUTH_LAM; JSESSIONID=61F12923C6E58695243E48B753DAFAFF 
Host:localhost:8080 
Referer:http://localhost:8080/SALYExplorer/ 
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 
+1

리소스를 보유하고있는'static' 폴더의 이름을 다른 이름으로 바꾸십시오. –

+1

Woh ... 고맙습니다 Aleksandr M. 당신은 저에게 생명의 은인입니다 :) 그것은 매력처럼 일했습니다. 따라서 우리는 어디서나 디렉토리 이름으로 키워드를 사용할 수 없습니다. 그러나이 업그레이드 전에 작동하고있었습니다. 어쨌든, 다시 한번 감사 드리며 새해를 맞이하겠습니다. – Vikd

+1

@ AleksandrM이 답을 보내 주시면이 질문에 답변 할 수 있습니다. –

답변

2

/static과 URL-의 시작은 클래스 경로에서 리소스를 검색하기위한이다 : 나는 브라우저에서 F12 키를 누르면

하지만, 나는 브라우저 콘솔에서 다음 오류가 표시 .

documentation에서 정적 컨텐츠 처리에 대해 자세히 읽어보십시오.

가장 간단한 해결책은 자원을 보유하고있는 폴더의 이름을 static에서 다른 것으로 변경하는 것입니다.

+1

@Vikd 댓글을 달았 으면 올바른 것으로 표시해주세요! –

+1

올바른 것으로 표시했습니다. :) – Vikd