2012-12-05 59 views
0

我試圖將vaadin appliaction嵌入div元素。 我按照本指南(12.3.1):將vaadin應用嵌入div元素

https://vaadin.com/book/-/page/application.embedding.html

我使用教程SimpleAddressBook例如對於我的實驗:

https://vaadin.com/tutorial

我的jsp:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<%@ page contentType="text/html;charset=UTF-8" language="java" %> 
<html> 
<head> 
    <title>HC</title> 

    <script type="text/javascript"> 
     var vaadin = { 
      vaadinConfigurations: { 
       trololo: { 
        appUri:'/trololo', 
        pathInfo: '/', 
        themeUri: '/VAADIN/themes/reindeer', 
        versionInfo : { 
         vaadinVersion: "6.8.6", 
         applicationVersion: "NONVERSIONED" 
        } 
       } 
      }}; 
    </script> 

    <script language="javascript" src="/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js?1354630345025"></script> 
</head> 
<body> 
<iframe tabindex="-1" id="__gwt_historyFrame" style="position:absolute;width:0;height:0;border:0;overflow:hidden;" src="javascript:false"></iframe> 

<div style="background-color: red; height: 150px"></div> 

<div id="trololo"></div> 
</body> 
</html> 

我web.xml:

<web-app xmlns="http://java.sun.com/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
     version="2.5"> 
    <servlet> 
     <servlet-name>SimpleAddressBook</servlet-name> 
     <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class> 
     <init-param> 
      <param-name>application</param-name> 
      <param-value>novikov.vaadin.SimpleAddressBook</param-value> 
     </init-param> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>SimpleAddressBook</servlet-name> 
     <url-pattern>/trololo/*</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>SimpleAddressBook</servlet-name> 
     <url-pattern>/VAADIN/*</url-pattern> 
    </servlet-mapping> 
</web-app> 

當我在瀏覽器中加載我的應用程序時,沒有vaadin樣式的請求,所以沒有任何工作在網頁上。

我試着將themeUri設置爲/ VAADIN/themes/reindeer;/VAADIN /主題;試圖把它留空。我只是貓讓它工作。幫助=)

回答

0

對不起,我的壞。忘記添加

<link rel="stylesheet" href="/VAADIN/themes/reindeer/styles.css"> 

認爲這是由themeUri參數設置的。