我正在尝试将 vaadin 应用程序嵌入到 div 元素中。我遵循本指南(12.3.1):
https://vaadin.com/book/-/page/application.embedding.html
我使用教程中的 SimpleAddressBook 示例进行实验:
我的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/主题;试图将其留空。我只是猫让它工作。帮助 =)