- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试学习版本 14 中的 Vaadin。为此,我安装了 Eclipse 的 Vaadin 设计器插件。一切正常,直到我尝试启动服务器并测试第一页。
There was an exception while trying to navigate to '' with the exception message 'Error creating bean with name 'com.project.gym.vaadin.MainPageDesign': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.project.gym.vaadin.MainPageDesign]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'main-page-design' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.project.gym.vaadin.MainPageDesign': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.project.gym.vaadin.MainPageDesign]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'main-page-design' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1320)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:307)
at com.vaadin.flow.spring.SpringInstantiator.getOrCreate(SpringInstantiator.java:117)
at com.vaadin.flow.di.Instantiator.createRouteTarget(Instantiator.java:158)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.lambda$getRouteTarget$1(AbstractNavigationStateRenderer.java:127)
at java.util.Optional.orElseGet(Optional.java:267)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getRouteTarget(AbstractNavigationStateRenderer.java:126)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.createChain(AbstractNavigationStateRenderer.java:314)
at com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.handle(AbstractNavigationStateRenderer.java:195)
at com.vaadin.flow.router.Router.handleNavigation(Router.java:223)
at com.vaadin.flow.router.Router.navigate(Router.java:194)
at com.vaadin.flow.router.Router.initializeUI(Router.java:92)
at com.vaadin.flow.server.BootstrapHandler.createAndInitUI(BootstrapHandler.java:1489)
at com.vaadin.flow.server.BootstrapHandler.synchronizedHandleRequest(BootstrapHandler.java:459)
at com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
at com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1540)
at com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:247)
at com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:95)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:352)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:141)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.project.gym.vaadin.MainPageDesign]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'main-page-design' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:216)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1312)
... 70 more
Caused by: java.lang.IllegalStateException: Couldn't find the definition of the element with tag 'main-page-design' in any template file declared using '@JsModule' annotations. Check the availability of the template files in your WAR file or provide alternative implementation of the method getTemplateContent() which should return an element representing the content of the template file
at com.vaadin.flow.component.polymertemplate.NpmTemplateParser.getTemplateContent(NpmTemplateParser.java:140)
at com.vaadin.flow.component.polymertemplate.TemplateDataAnalyzer.parseTemplate(TemplateDataAnalyzer.java:200)
at com.vaadin.flow.component.polymertemplate.TemplateInitializer.<init>(TemplateInitializer.java:91)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:88)
at com.vaadin.flow.component.polymertemplate.PolymerTemplate.<init>(PolymerTemplate.java:103)
at com.project.gym.vaadin.MainPageDesign.<init>(MainPageDesign.java:31)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:203)
... 72 more
据我了解,我的设计是错误的。我在 webapp/frontend、frontend 和 template 目录以及带有 .java 文件的目录中尝试了它。总是出现同样的错误。因此我的问题是,我应该把我的设计放在哪里?
<link rel="import" href="polymer.html">
<link rel="import" href="../../../../../bower_components/vaadin-button/src/vaadin-button.html">
<dom-module id="main-page-design">
<template>
<style include="shared-styles">
:host {
display: block;
height: 100%;
}
</style>
<div id="div" style="width: 100%; height: 100%;">
<vaadin-button id="loginButton"></vaadin-button>
</div>
</template>
<script>
class MainPageDesign extends Polymer.Element {
static get is() {
return 'main-page-design';
}
static get properties() {
return {
// Declare your properties here.
};
}
}
customElements.define(MainPageDesign.is, MainPageDesign);
</script>
</dom-module>
package com.project.gym.vaadin;
import com.vaadin.flow.templatemodel.TemplateModel;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.HtmlImport;
import com.vaadin.flow.component.polymertemplate.PolymerTemplate;
import com.vaadin.flow.dom.Element;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.component.polymertemplate.Id;
import com.vaadin.flow.component.button.Button;
/**
* A Designer generated component for the main-page-design template.
*
* Designer will add and remove fields with @Id mappings but
* does not overwrite or otherwise change this file.
*/
@Route("")
@Tag("main-page-design")
@HtmlImport("context://src/main/resources/frontend/main-page-design.html")
public class MainPageDesign extends PolymerTemplate<MainPageDesign.MainPageDesignModel> {
@Id("div")
private Element div;
@Id("loginButton")
private Button loginButton;
/**
* Creates a new MainPageDesign.
*/
public MainPageDesign() {
// You can initialise any data required for the connected UI components here.
}
/**
* This model binds properties between MainPageDesign and main-page-design
*/
public interface MainPageDesignModel extends TemplateModel {
// Add setters and getters for template properties here.
}
}
最佳答案
您是否在 compatibility mode 中使用 Vaadin ?在你的错误中它指出
Couldn't find the definition of the element with tag 'main-page-design' in any template file declared using
@JsModule
annotations.
所以我猜你不会。在这种情况下,您应该使用 @JsModule
导入模板,模板本身就是一个 .js
文件。
看来您使用了 V13 版本的示例。 Vaadin 14 已迁移到 Polymer 3(之前是 Polymer 2),并且版本之间的语法已发生变化。
但你也是对的,文件应该放在另一个目录中。您应该使用项目根目录下的 /frontend
目录。这里对所有类型的资源都有一个很好的概述:Ways of importing
有关使用模板 API 创建组件的文档可以在这里找到:Creating a Simple Component Using the Template API
关于java - Eclipse Vaadin 设计器 10+ html 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59919977/
我有一个示例应用程序,包含以下三个步骤 输入用户详细信息 -> 个人详细信息 -> 完成 当我点击一个链接时,它会调用我的 vaadin 应用程序。问题是一旦我的三步过程完成,当我再次尝试点击我的 v
我希望框架捕获每个未捕获的异常并显示适当的通知消息。 因此我在我的 UI 中设置了一个自定义的 ErrorHandler(灵感来自“Book of Vaadin”:https://vaadin.com
我在 Vaadin 有一张 table 。一列是 String 类型,因此其大小是可变的。因此,我想让列的宽度固定(具有扩展比率),但每行的高度应该是可变的(根据其内容 - 字符串)。 即,这是预期的
有谁知道用于 vaadin 框架的数据可视化(图表、饼图等)的任何 UI 组件库? 最佳答案 我建议 dChart: https://vaadin.com/directory#!addon/dchar
我在 Grid 中使用 BeanItemContainer 来显示我的数据。我需要根据单元格中的数据分别为每个单元格着色。 最佳答案 section about the Grid在 Vaadin 的书
在我的一个应用程序中,我创建了一个页脚: public Footer(){ hl.setHeight("120px"); hl.setWidth("100%");
是否有任何特定方法可以在 Vaadin 表中实现分页/延迟加载。 我试图找到一些文档,但我找不到。 最佳答案 使用Viritin add-on及其 MTable 组件。 I 是最有效的(服务器资源副)
我正在尝试使用 Vaadin Charts 创建饼图。 这段代码为图表添加了漂亮的标签,但小数点 t 后两位数字就足够了。 dataLabels.setFormatter("''+ this.poi
我是 vaadin 框架的新手,一切正常,直到......表头没有正确显示,......我正在开发一个在 exoplatform 上运行的 portlet,我正在使用 vaadin 6,我的表只显示第
我有一个带有基于复杂查询填充数据的表的页面(即使我使用分页也需要很多时间)。我使用 BeanItemcontainer 将数据加载到表中。现在遇到问题,我希望以异步方式将数据加载到表中(在用户屏幕上加
我有一个现有的应用程序(在 WebGuiToolkit.org 中编写),我正在尝试在其中嵌入一个 Vaadin 14 页面。 我看过几个 Vaadin 8 指南,比如 https://vaadin.
更改pom.xml文件的vaadin版本号和vaadin插件版本号后构建失败 7.4.5 7.4.5 然后我尝试清理并重建项目,但显示构建失败: Copying 3 resources --- va
我想通过更改文件列表中元素的外观来设置 Vaadin Upload 组件 (vaadin-upload) 的样式,例如隐藏命令按钮(开始、删除、重试)。文件列表包含 vaadin-upload-fil
如何向文本字段、选项卡、链接、标签等添加悬停文本(即当我将鼠标悬停在组件上时出现的包含一些解释或详细信息的文本框) 我用谷歌搜索并浏览了“Book of Vaadin”和“Building Moder
this.grid.asSingleSelect().addValueChangeListener(event -> { if (!Objects.isNull(event.getVa
在 Vaadin 中,一旦您有了 TabSheet,并且已经打开了一些选项卡,您就不会希望多次打开包含相同内容的同一个 Tab。 如何检查选项卡是否已打开并将其设置为选定的选项卡? 最佳答案 默认情况
我已经使用 vaadin 创建了表格。现在我想为该表格中的特定列内容设置字体大小。是否可以为该表格中的特定列设置字体大小?。 如果是这样,请给我设置字体大小的想法。如果你能提供我一些代码片段。 最佳答
是否可以在 vaadin 中以百分比设置表格的列宽。如果可以,请告诉我如何使用示例代码片段来做到这一点。提前谢谢。 最佳答案 是的。为此使用 Table.setColumnExpandRatio(co
我正在开发 Vaadin 8 UI。目前,每次修改 UI 时,我都必须重新启动我的应用程序。 有没有更好的办法?我曾尝试附加 Java 调试器并使用 IntelliJ 的 Reload Changed
序言:我是Vaadin的高级开发人员(我用过6、7,现在我的所有项目都已迁移到Vaadin 8)。 我开始学习Vaadin 10/Flow,但发现自己在一些热水中。 我实际上在挣扎的是“项目”本身。
我是一名优秀的程序员,十分优秀!