编写 Vaadin 项目的有效方法是什么?
我正在寻找在 Vaadin 中编写 Java Web 应用程序的有效方法。 (几页,很多表格,按钮..)
我应该从什么开始?
从编写所有需要的组件、布局、面板开始,然后合并所有这些以构建单个页面是一个很好的解决方案吗?
或者也许最好编写每个页面而不考虑整个项目(当然,除了更改页面),例如:首先我编写登录页面(以及我需要的所有内容),接下来我编写管理页面等..
问题涉及 Vaadin,但了解它在其他 Java Web 框架中的样子也很好。
I'm looking for effective approach to writing Java web app in Vaadin.
(several pages, a lot of tables, buttons..)
From what should I start ?
It's good solution to begin from writing all needed components, layouts, panels and next merge all that to build single pages ?
or maybe it's better to write every single page with no thinking about the entire project (of course, except changing pages), so for example: first I write login page (and all stuff I need for it), next I write admin page etc..
question concerns Vaadin, but it would be also fine to know, how it looks like in other Java web frameworks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最近刚刚进入 Vaadin,这是我用来启动我的应用程序的方法。
首先查看采样器应用程序,了解 Vaadin 的功能:Sampler
如果您正在使用eclipse 获取插件。使用 Eclipse 中内置的“安装新软件”功能(帮助 -> 安装新软件)只需输入链接并安装插件: Eclipse 插件
使用该插件创建一个基本的 vaadin 项目。在项目资源管理器中右键单击 ->新->瓦丁项目
然后浏览网站上的“1 小时”教程版本教程
它将引导您逐步了解如何创建一个应用程序,还将为您提供组织项目的基本结构。尝试自己尽可能多地写,然后在遇到困难时查看示例。
布局简而言之:
在最简单的级别上,您将拥有垂直布局。
然后您将向此布局添加面板。面板类似于 div 元素。向面板添加标题。使用verticalLayout.setSpacing(true) 来分隔布局中的元素。
然后,您将向面板添加内容,例如用于显示数据的表格或表单或网格布局。内容中的元素(例如表格)可以链接到作为元素的数据源的容器。
基本方法:
创建:
布局(组织元素)->要放置在布局中的元素 ->元素的侦听器(处理 onClick 等事件)->与数据交互的元素的容器(为了处理持久性和数据填充)
我想说让一个页面工作得相当好,然后从那里扩展。花额外的时间学习容器的工作原理。
I am recently just got into Vaadin and this is the method I used to get my app off the ground.
First off check out the sampler application to get an idea of what is possible with Vaadin: Sampler
If you are using eclipse get the plug-in. Using the built-in "Install New software" function in Eclipse(Help -> Install new software) just type in the link and install the plugin: Eclipse Plugin
Use the plugin to create a basic vaadin project. Right-click in the Project explorer -> New -> Vaadin Project
Then go through the "1-hour" tutorial version on the site Tutorial
It will take you step by step into how to create a application and also will give you a basic structure by which to organize your project. Try to write as much as you can yourself and then look at the examples when you get stuck.
Layout in a nutshell:
At the most simple level you will have a vertical layout.
Then you will add a panels to this layout. A panel is similar to a div element. Add captions to panels. Use verticalLayout.setSpacing(true) to space out the elements in a layout.
Then you will add content to the panels such as a table for displaying data or a form or grid layout. Elements in the content such as a table can be linked to a container which is a datasource for a element.
Basic approach:
Create:
Layout(To organize elements) -> Elements to be placed in layout -> listeners for elements(To handle events like onClick) -> containers for elements that interact with data(To handle persistence and data population)
I'd say get one page working fairly well then expand out from there. Spend extra time learning how containers work.
您可以查看Instant WebApp作为您的应用的起点。
You might check out the Instant WebApp as a starting point for your app.