2016-12-30 5 views
1

最近、私のアプリケーションをStruts 2.5.8およびTiles 3.0.7にアップグレードしました。私はSpring v4.3.4にもアップグレードしましたが、タイルと統合されていません。私は今までエラーなしでアプリケーションを正しく起動することができます。Struts 2.5.8およびTiles 3.0.7:JSPページ内のimg、css、jsなどのリソースをロードできません。

すべてが表示されます。struts.xmltiles.xmlファイルが正しくロードされ、正しくレンダリングされています。しかし、最初の(ログイン)ページを開くと、webappディレクトリ内にあるCSS、JS、イメージなどのリソースをロードできないことがわかります。私は、ログファイルのどこにもエラーは見られません。

しかし、私は、ブラウザでF12キーを押したときに、私は、ブラウザのコンソールで以下のエラーを参照してください。/staticで始まるStruts2のURL-Sで

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

クラスパスからリソースを取得するためのものである

documentationの静的コンテンツの取り扱いについて詳しくは、こちらをご覧ください。

問題の最も簡単な解決策は、リソースを保持するフォルダの名前をstaticから別のものに変更することです。

+1

@Vikdあなたがコメントした通り、それを正しいものとしてマークしてください! –

+1

私はそれを正しいとマークしました:) – Vikd

関連する問題