将vaadin应用程序嵌入到div元素中

时间:2012-12-05 08:57:03

标签: java html vaadin embedding

我正在尝试将vaadin appliaction嵌入到div元素中。 我遵循本指南(12.3.1):

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 /主题;试图把它留空。我只是让它工作。帮助=)

1 个答案:

答案 0 :(得分:0)

对不起,我的不好。忘了添加

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

认为这是由themeUri参数设置的。