2017-09-18 4 views
0

私は完全にクライアントコードで構成されたGWTを使用してウェブサイトを作成しました。 enter image description hereパッケージgwtクライアントコード

しかし:(:GWTを爆発:DEVMODEをMVNクリーン戦争)私はそれを期待して、それが見えます私はDEVMODEでアプリケーションを実行すると

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
    When updating your version of GWT, you should also update this DTD reference, 
    so that your app can take advantage of the latest GWT module capabilities. 
--> 
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.1//EN" "http://gwtproject.org/doctype/2.8.1/gwt-module.dtd"> 
<module rename-to='arithmeticexercisegeneratorclient'> 
    <!-- Inherit the core Web Toolkit stuff.      --> 
    <inherits name='com.google.gwt.user.User'/> 
    <inherits name='com.google.gwt.json.JSON'/> 

    <!-- Inherit the default GWT style sheet. You can change  --> 
    <!-- the theme of your GWT application by uncommenting   --> 
    <!-- any one of the following lines.       --> 
    <inherits name='com.google.gwt.user.theme.standard.Standard'/> 
    <inherits name="com.vaadin.polymer.Elements"/> 

    <!-- Other module inherits          --> 
    <inherits name='com.github.nmorel.gwtjackson.GwtJackson'/> 

    <!-- Specify the app entry point class.       --> 
    <entry-point class='com.onelostlogician.generator.exercise.arithmetic.client.ArithmeticExerciseGeneratorClient'/> 

    <!-- Specify the paths for translatable code     --> 
    <!--<source path='client'/>--> 

    <!-- allow Super Dev Mode --> 
    <add-linker name="xsiframe"/> 
</module> 

:.gwt.xmlファイルがあります私は、コードをパッケージ化し、ブラウザで結果のWebページを開く取るとき、それはすべてのスタイリング/書式設定を失う:

enter image description here

ベースHTMLファイルには、お使いのブラウザは奇妙なキャッシュされたが、Ctrlキー+ F5を行うと、それはそれを修正するかどうかを確認してみてください何かを持っている

<!doctype html> 
<html> 
<head> 
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1" /> 
    <link type="text/css" rel="stylesheet" href="ArithmeticExerciseGeneratorClient.css"> 
    <script type="text/javascript" src="arithmeticexercisegeneratorclient/arithmeticexercisegeneratorclient.nocache.js"></script> 
</head> 
<body> 
    <div id="clientContent"></div> 
    <noscript> 
    <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"> 
     Your web browser must have JavaScript enabled 
     in order for this application to display correctly. 
    </div> 
    </noscript> 
</body> 
</html> 

答えて

1

簡単(しかし、そう答え)です。

404エラーが表示された場合はネットワークパネルを確認します。この場合、パズルの欠けている部分が見つかりました。

最後に、「mvn clean package」を実行してWARを掘り下げて、見つからないCSSがどこにあるかを知ることができます。

EDIT:

あなたはいたずらを見つけました!

問題は、file://です。 HTTP(s)を介してそれらのファイルにアクセスすると、すべてが動作します。

クイックテストを行うには、サーバーにファイルをアップロードするか、またはphp -S ...docs)の迅速で汚れたローカルサーバーを作成します。

+0

「キャンセルされました」というfile:/// [編集済み] /算術運動生成者クライアント1.0-SNAPSHOT/arithmeticexercisegeneratorclient/bower_components/polymer/polymer.htmlへのネットワークコールがあります。私はコンソールを見ると、エラーが表示されます: "インポートされたリソースへのアクセス 'ファイル:/// [編集] /算術 - エクセリ - ジェネレーター - クライアント-1.0-SNAPSHOT/arithmeticexercisegeneratorclient/bower_components/polymer/polymer.html'オリジン 'null'がCORSポリシーによってブロックされています:無効な応答。オリジン 'null'はアクセスが許可されていません。 – user1853665

関連する問題