2017-09-18 7 views
0

나는 클라이언트 코드로만 구성된 GWT를 사용하여 웹 사이트를 만들었습니다. 하며 .gwt.xml 파일은 다음과 같습니다 (: GWT 폭발 : MVN 깨끗한 전쟁이 DEVMODE를) 내가 DEVMODE에서 응용 프로그램을 실행할 때패키지 gwt 클라이언트 코드

<?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> 

, 그것은 보인다 내가 예상대로 :

enter image description here

그러나

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 : /// [편집 됨 /] arithmetic-exercise-generator-client-1.0-SNAPSHOT/arithmeticexercisegeneratorclient/bower_components/polymer/polymer.html에 대한 네트워크 호출이 있습니다. 콘솔을 보면 다음과 같은 오류가 있습니다. "가져온 리소스에 대한 액세스 권한 (file : /// [redacted] /arithmetic-exercise-generator-client-1.0-SNAPSHOT/arithmeticexercisegeneratorclient/bower_components/polymer/polymer.html) origin 'null'에서 CORS 정책에 의해 차단되었습니다 : 잘못된 응답. 'null'원본은 액세스가 허용되지 않습니다. " – user1853665