从Vaadin 8应用程序生成HTML页面,并在新窗口中打开 [英] Generate an HTML page, and open in a new window, from a Vaadin 8 app

查看:466
本文介绍了从Vaadin 8应用程序生成HTML页面,并在新窗口中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的Vaadin 8网络应用程序中,我希望用户能够通过单击按钮在另一个窗口中打开报告。内容将由Vaadin应用程序使用纯HTML5而不是使用Vaadin小部件生成。



Vaadin 8手册有一个页面





如该页面所示手册,你需要使用 BrowserWindowOpener (或 链接 )。由于浏览器常见的安全限制,必须提前配置,然后用户单击按钮。因此,我们必须提前配置 BrowserWindowOpener 对象,并与按钮关联,而不是在按钮的单击侦听器中编写代码。



定义用户点击的按钮以生成报告。

 按钮webPageButton = new按钮(生成人报告); 

定义要打开的新窗口的目的地,它应该用作其网址的URL。我们想回到我们的Vaadin应用程序。因此,请在运行时获取此Web应用程序的URL。 Java Servlet术语中我们的Web应用程序的技术术语是上下文。所以我们询问当前上下文的URL(路径)。

  String servletPath = VaadinServlet.getCurrent()。getServletContext()。getContextPath(); //运行时此Web应用程序的URL。 

我们需要将该URL缩小到我们的报告,详细说明一个 Person 要从数据库加载的对象。因此,我们发明 person.html 作为我们网址中请求的资源。



我们想要一个动态生成的HTML页面,而不需要调用Vaadin小部件,所以我们使用 ExternalResource class。

 资源资源=新的ExternalResource(servletPath +/ person.html); //将外部资源定义为一个非常外部的URL  - 将回调到同一个Web应用程序。 

资源 手中的对象,我们准备好了定义 BrowserWindowOpener

  BrowserWindowOpener webPageOpener = new BrowserWindowOpener(resource) ; 

让我们配置一些属性,例如要打开的窗口的标题。

  webPageOpener.setWindowName(Person ID:+ personUuid.getValue()); //设置要打开的新窗口的标题。 

我们想传递要从数据库中检索的人行的ID然后显示在我们生成的网页中。



将此类信息作为参数传递到查询字符串。所以我们网址的最后一部分看起来像 person.html?person_id = f0e32ddc-18ed-432c-950b-eda3f3e4a80d 。此值必须是文本的,因此我们使用规范的36个字符的十六进制字符串表示 UUID的128位作为数据库标识符。我们为此值赋予一个任意键名,例如 person_id

  String param =person_id; 
webPageOpener.setParameter(param,personUuid.getValue());

我们可以设置要打开的新窗口的大小。我们将在运行时使其与用户当前窗口的大小相同。并且我们将使窗口可调整大小,因此用户可以将其拉伸更大或更小。我们希望以字符串中描述的窗口特征结束,例如 width = 800,height = 600,resizable 。我们将在运行时插入宽度和高度。

  String windowFeaturesString = String.format(width =%d,height = %d,resizable,Page.getCurrent()。getBrowserWindowWidth(),Page.getCurrent()。getBrowserWindowHeight()); //与原始窗口大小相同。 
webPageOpener.setFeatures(windowFeaturesString); //示例:width = 800,height = 600,resizable。

我们已完成配置要打开的新窗口。由于用户在事件监听器中按钮点击不能像通常对其他行为那样调用窗口打开,因此我们必须提前将开启者与按钮关联。

  webPageOpener.extend(webPageButton); //将开启者与按钮相关联。 

为了好玩,我们可以预览新窗口要调用的URL。在实际工作中,请使用此处的日志记录框架,例如 SLF4J LogBack 。对于此演示,我们转储到控制台。

  System.out.println(TRACE BrowserWindowOpener URL:+ webPageOpener.getUrl( )); 

好,我们现在有一个开启器设置的按钮,要求生成基于HTML的报告。接下来我们必须生成该报告。要做到这一点,请告诉我们的Vaadin应用程序,以期望我们在上面指定的 person.html 网址的传入网址。我们通过实施来实现这一目标 RequestHandler 界面。请参阅手册



在我们的 RequestHandler 中,我们做了四件事:


  1. 检索在新窗口中打开的URL的查询字符串中作为参数传递的UUID的十六进制字符串。

  2. 重构 UUID 来自该十六进制字符串的对象。

  3. UUID 对象传递给生成要显示的HTML的例程在这个新窗口中。

  4. 将新窗口中的HTML传递给 VaadinResponse 对象,并将其传递回新窗口。用户的Web浏览器通过Java Servlet技术。

我们必须实例化我们的 RequestHandler 实现,并使用用户的会话注册实例, VaadinSession 对象。

  VaadinSession.getCurrent ()。addRequestHandler(
new RequestHandler(){
@Override
public boolean handleRequest(VaadinSession session,
VaadinRequest request,
VaadinResponse response)
throws IOException {
if(/ panel.html.equals(request.getPathInfo())){
//从URL的查询字符串参数中检索UUID的十六进制字符串。
字符串uuidString = request.getParameter(person_id); //在实际工作中,在此验证结果。
UUID uuid = UUID.fromString(uuidString); //从该十六进制字符串重构一个`UUID`对象。在实际工作中,请在此处验证结果。
System.out.println(从在新窗口中打开的URL的查询字符串中作为参数传递的字符串重构的UUID对象:+ uuid);
//构建HTML。
String html = renderHtml(uuid);
//以UTF-8字符编码的形式将生成的文本发送为HTML。
response.setContentType(text / html; charset = utf-8);
response.getWriter()。append(html);
返回true; //我们写了一个回复
}其他
返回false; //没有回复写入
}
});

填写该方法以生成HTML。

  //在给定该数据库行的UUID的情况下,生成HTML以从数据库报告person的详细信息。 
private String renderHtml(UUID uuid){
String eol =\ n; //在HTML中使用的行尾字符。
StringBuilder html = new StringBuilder();
html.append(<!DOCTYPE html>)。append(eol);
html.append(< html>)。append(eol);
html.append(< head>)。append(eol);
html.append(< title> Person< / title>)。append(eol);
html.append(< / head>)。append(eol);
html.append(< body style ='color:DarkSlateGray'>)。append(eol);
html.append(< h1> Demo< / h1>)。append(eol);
html.append(< p>这是一个练习。这只是一个练习。< / p>)。append(eol);
html.append(< p>如果这是一个真正的应用程序,你会看到一些数据。< / p>)。append(eol);
html.append(< p> Person ID:)。append(uuid.toString())。append(。< / p>)。append(eol);
html.append(< p style ='color:DimGray; font-family:Pragmata Hack Menlo monospaced'> Report generated)。append(Instant.now())。append(。< / p>)。append(eol);
html.append(< / body>)。append(eol);
html.append(< / html>)。append(eol);
String s = html.toString();
返回s;
}

生成的HTML源代码如下所示:

 <!DOCTYPE html> 
< html>
< head>
< title> Person< / title>
< / head>
< body style ='color:DarkSlateGray'>
< h1>演示< / h1>
< p>这是一个演习。这只是一次演习。< / p>
< p>如果这是一个真实的应用程序,你会看到一些数据。< / p>
< p>人ID:cc5e975b-2632-4c92-a1cb-b25085c60e60。< / p>
< p style ='color:DimGray; font-family:Pragmata,Hack,Menlo,monospace'>报告生成2018-08-05T02:33:13.028594Z。< / p>
< / body>
< / html>

为了您的方便,这里是整个Vaadin 8应用程序, MyUI.java 文件首先由Vaadin Ltd公司提供的最简单的Maven原型生成。

  package com.basilbourque.example; 

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server。*;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

import java.io.IOException;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.UUID;

/ **
*此UI是应用程序入口点。 UI可以表示浏览器窗口
*(或制表符)或嵌入了Vaadin应用程序的HTML页面的某些部分。
*< p>
*使用{@link #init(VaadinRequest)}初始化UI。此方法旨在被
*重写,以将组件添加到用户界面并初始化非组件功能。
* /
@Theme(mytheme)
公共类MyUI扩展UI {

@Override
protected void init(VaadinRequest vaadinRequest){
final VerticalLayout layout = new VerticalLayout();

TextField personUuid = new TextField(UUID of Person:);
personUuid.setWidth(22,Unit.EM);
personUuid.setValue(UUID.randomUUID()。toString());
personUuid.setReadOnly(true);

按钮webPageButton = new按钮(生成人员报告);
webPageButton.setWidthUndefined();
webPageButton.addClickListener(e - > {
System.out.println(Click clicked。+ ZonedDateTime.now());
});

//配置网页开启对象。必须在*用户点击按钮之前完成*,而不是之后。
String servletPath = VaadinServlet.getCurrent()。getServletContext()。getContextPath(); //运行时此Web应用程序的URL。
资源资源= new ExternalResource(servletPath +/ person.html); //将外部资源定义为一个非常外部的URL - 将回调到同一个Web应用程序。
BrowserWindowOpener webPageOpener = new BrowserWindowOpener(resource);
webPageOpener.setWindowName(Person ID:+ personUuid.getValue()); //设置要打开的新窗口的标题。
String param =person_id;
webPageOpener.setParameter(param,personUuid.getValue());
String windowFeaturesString = String.format(width =%d,height =%d,resizable,Page.getCurrent()。getBrowserWindowWidth(),Page.getCurrent()。getBrowserWindowHeight()); //与原始窗口大小相同。
webPageOpener.setFeatures(windowFeaturesString); //示例:width = 800,height = 600,resizable。
webPageOpener.extend(webPageButton); //用开启者连接按钮。
System.out.println(TRACE BrowserWindowOpener URL:+ webPageOpener.getUrl());

layout.addComponents(personUuid,webPageButton);
setContent(layout);

//生成一些内容的请求处理程序
VaadinSession.getCurrent()。addRequestHandler(
new RequestHandler(){
@Override
public boolean handleRequest(VaadinSession session,
VaadinRequest请求,
VaadinResponse响应)
抛出IOException {
if(/ person.html.equals(request.getPathInfo())){
//从URL的查询字符串参数中检索UUID的十六进制字符串。
字符串uuidString = request.getParameter(person_id); //在实际工作中,验证结果。
UUID uuid = UUID.fromString(uuidString); //从该十六进制字符串中重构一个`UUID`对象。在实际工作中,验证结果这里。
System.out.println(从在新窗口中打开的URL的查询字符串中作为参数传递的字符串重构的UUID对象:+ uuid);
//构建HTML。
String html = renderHtml(uuid);
//以UTF-8字符编码的形式将生成的文本发送为HTML。
response.setContentType(text / html; charset = utf-8);
response.getWriter()。append(html);
返回true; //我们写了一个回复
}其他
返回false; //没有回复写入
}
});
}

//在给定该数据库行的UUID的情况下,生成HTML以从数据库报告person的详细信息。
private String renderHtml(UUID uuid){
String eol =\ n; //在HTML中使用的行尾字符。
StringBuilder html = new StringBuilder();
html.append(<!DOCTYPE html>)。append(eol);
html.append(< html>)。append(eol);
html.append(< head>)。append(eol);
html.append(< title> Person< / title>)。append(eol);
html.append(< / head>)。append(eol);
html.append(< body style ='color:DarkSlateGray'>)。append(eol);
html.append(< h1> Demo< / h1>)。append(eol);
html.append(< p>这是一个练习。这只是一个练习。< / p>)。append(eol);
html.append(< p>如果这是一个真正的应用程序,你会看到一些数据。< / p>)。append(eol);
html.append(< p> Person ID:)。append(uuid.toString())。append(。< / p>)。append(eol);
html.append(< p style ='color:DimGray; font-family:Pragmata,Hack,Menlo,monospace'>报告生成).append(Instant.now())。append( 。< / p>)。append(eol);
html.append(< / body>)。append(eol);
html.append(< / html>)。append(eol);
String s = html.toString();
System.out.println(\ n \ n+ + s +\ n \ n);
返回s;
}

@WebServlet(urlPatterns =/ *,name =MyUIServlet,asyncSupported = true)
@VaadinServletConfiguration(ui = MyUI.class,productionMode = false)
公共静态类MyUIServlet扩展VaadinServlet {
}
}


From my Vaadin 8 web app, I want the user to be able to open a report in another window, by clicking a button. The contents are to be generated by the Vaadin app using plain HTML5 rather than using Vaadin widgets.

The Vaadin 8 manual has a page Handling Browser Windows. Its shows the use of a BrowserWindowOpener object to open a new window. But that window contains a Vaadin UI subclass, whereas I want to generate my own HTML content.

Bonus points for passing information such as a database identifier value.

解决方案

Here is an entire example app, built in Vaadin 8.5.1. We present a UUID as text in a TextField, with a button that opens a second window showing a web page with HTML generated by our Vaadin app without using Vaadin widgets or layouts. The id from that field is passed to the new window, which in a real app could be used for a database lookup.

As shown on that page in the manual, you do need to use a BrowserWindowOpener (or a Link). This must be configured ahead of time, before the user clicks the button because of security restrictions common to browsers. So instead of writing code in a button’s click listener, we must earlier configure the BrowserWindowOpener object, and associate with a button.

Define the button to be clicked by the user to generate the report.

Button webPageButton = new Button( "Generate Person report" );

Define the destination for the new window to be opened, what URL it should use as its web address. We want to call back into our Vaadin app. So get the URL of this web app at runtime. The technical term for our web app in Java Servlet terminology is "context". So we ask the current context for its URL (path).

String servletPath = VaadinServlet.getCurrent().getServletContext().getContextPath(); // URL for this web app at runtime.

We need to narrow that URL to our report, detailing a single Person object to be loaded from the database. So we invent person.html as the resource being requested in our URL.

We want to ask for a dynamically generated HTML page without invoking Vaadin widgets, so we use the ExternalResource class.

Resource resource = new ExternalResource( servletPath + "/person.html" );  // Defining an external resource as a URL that is not really so external -- will call back into this same web app.

With that Resource object in hand, we are ready to define the BrowserWindowOpener.

BrowserWindowOpener webPageOpener = new BrowserWindowOpener( resource );

Let’s configure some of its attributes, such as the title of the window to be opened.

webPageOpener.setWindowName( "Person ID: " + personUuid.getValue() );  // Set title of the new window to be opened.

And we want to pass the ID of the "person" row to be retrieved from the database and then displayed in our generated web page.

One way to pass information such as this as a parameter in a query string on the URL. So the last part of our URL will look something like person.html?person_id= f0e32ddc-18ed-432c-950b-eda3f3e4a80d. This value must be textual, so we use the canonical 36-character hex string representing the 128-bits of a UUID as our database identifier. We give this value an arbitrary key name such as person_id .

String param = "person_id";
webPageOpener.setParameter( param , personUuid.getValue() );

We can set the size of the new window to be opened. We will make it the same size as the user’s current window at runtime. And we will make the window resizable, so the user can stretch it larger or smaller. We want to end up with window features described in a string such as width=800,height=600,resizable. We will plug in that width and height at runtime.

String windowFeaturesString = String.format( "width=%d,height=%d,resizable" , Page.getCurrent().getBrowserWindowWidth() , Page.getCurrent().getBrowserWindowHeight() ) ; // Same size as original window.
webPageOpener.setFeatures( windowFeaturesString );  // Example: "width=800,height=600,resizable".

We are done configuring the new window to be opened. Since window-opening cannot be called as result of the button-click by user in an event listener as might normally do for other behaviors, we must associate the opener with the button ahead of time.

webPageOpener.extend( webPageButton ); // Associate opener with button.

For fun, we can get a preview of the URL to be invoked by the new window. In real work, use a logging framework here such as SLF4J and LogBack. For this demo, we dump to console.

System.out.println( "TRACE BrowserWindowOpener URL: " + webPageOpener.getUrl() );

Good, we now have button with an opener set to ask for a HTML-based report to be generated. Next we must generate that report. To do that, tell our Vaadin app to expect an incoming URL with the person.html URL we specified above. We do that by implementing the RequestHandler interface. See the manual.

In our RequestHandler we do four things:

  1. Retrieve the hex-string of the UUID passed as a parameter in the query string of the URL opened in the new window.
  2. Reconstitute a UUID object from that hex-string.
  3. Pass that UUID object to a routine generating the HTML to be displayed in this new window.
  4. Display that HTML in the new window by passing it to the VaadinResponse object which gets passed along back to the user’s web browser via Java Servlet technology.

And we must instantiate our RequestHandler implementation, and register the instance with the user’s session, a VaadinSession object.

VaadinSession.getCurrent().addRequestHandler(
        new RequestHandler() {
            @Override
            public boolean handleRequest ( VaadinSession session ,
                                           VaadinRequest request ,
                                           VaadinResponse response )
                    throws IOException {
                if ( "/panel.html".equals( request.getPathInfo() ) ) {
                    // Retrieve the hex-string of the UUID from the URL’s query string parameter.
                    String uuidString = request.getParameter( "person_id" );  // In real-work, validate the results here.
                    UUID uuid = UUID.fromString( uuidString ); // Reconstitute a `UUID` object from that hex-string. In real-work, validate the results here.
                    System.out.println( "UUID object reconstituted from string passed as parameter in query string of URL opened in new window: " + uuid );
                    // Build HTML.
                    String html = renderHtml( uuid );
                    // Send out the generated text as HTML, in UTF-8 character encoding.
                    response.setContentType( "text/html; charset=utf-8" );
                    response.getWriter().append( html );
                    return true; // We wrote a response
                } else
                    return false; // No response was written
            }
        } );

Fill in that method to generate the HTML.

// Generate the HTML to report on the details of a `person` from the database, given the UUID of that database row.
private String renderHtml ( UUID uuid ) {
    String eol = "\n"; // End-of-line character(s) to use in the HTML.
    StringBuilder html = new StringBuilder();
    html.append( "<!DOCTYPE html>" ).append( eol );
    html.append( "<html>" ).append( eol );
    html.append( "<head>" ).append( eol );
    html.append( "<title>Person</title>" ).append( eol );
    html.append( "</head>" ).append( eol );
    html.append( "<body style='color:DarkSlateGray' >" ).append( eol );
    html.append( "<h1>Demo</h1>" ).append( eol );
    html.append( "<p>This is a drill. This is only a drill.</p>" ).append( eol );
    html.append( "<p>If this had been a real application, you would have seen some data.</p>" ).append( eol );
    html.append( "<p>Person ID: " ).append( uuid.toString() ).append( ".</p>" ).append( eol );
    html.append( "<p style='color:DimGray ; font-family: Pragmata Hack Menlo monospaced' >Report generated " ).append( Instant.now() ).append( ".</p>" ).append( eol );
    html.append( "</body>" ).append( eol );
    html.append( "</html>" ).append( eol );
    String s = html.toString();
    return s;
}

Resulting HTML source code looks something like this:

<!DOCTYPE html>
<html>
<head>
<title>Person</title>
</head>
<body style='color:DarkSlateGray' >
<h1>Demo</h1>
<p>This is a drill. This is only a drill.</p>
<p>If this had been a real application, you would have seen some data.</p>
<p>Person ID: cc5e975b-2632-4c92-a1cb-b25085c60e60.</p>
<p style='color:DimGray ; font-family: Pragmata , Hack , Menlo , monospace' >Report generated 2018-08-05T02:33:13.028594Z.</p>
</body>
</html>

For your convenience, here is that entire Vaadin 8 app, the contents of the MyUI.java file first generated by the simplest Maven archetype provided by the Vaadin Ltd company.

package com.basilbourque.example;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.*;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

import java.io.IOException;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.UUID;

/**
 * This UI is the application entry point. A UI may either represent a browser window
 * (or tab) or some part of an HTML page where a Vaadin application is embedded.
 * <p>
 * The UI is initialized using {@link #init(VaadinRequest)}. This method is intended to be
 * overridden to add component to the user interface and initialize non-component functionality.
 */
@Theme ( "mytheme" )
public class MyUI extends UI {

    @Override
    protected void init ( VaadinRequest vaadinRequest ) {
        final VerticalLayout layout = new VerticalLayout();

        TextField personUuid = new TextField( "UUID of Person:" );
        personUuid.setWidth( 22 , Unit.EM );
        personUuid.setValue( UUID.randomUUID().toString() );
        personUuid.setReadOnly( true );

        Button webPageButton = new Button( "Generate Person report" );
        webPageButton.setWidthUndefined();
        webPageButton.addClickListener( e -> {
            System.out.println( "Button clicked. " + ZonedDateTime.now() );
        } );

        // Configure web page opener object. Must be done *before* user clicks on button, not after.
        String servletPath = VaadinServlet.getCurrent().getServletContext().getContextPath(); // URL for this web app at runtime.
        Resource resource = new ExternalResource( servletPath + "/person.html" );  // Defining an external resource as a URL that is not really so external -- will call back into this same web app.
        BrowserWindowOpener webPageOpener = new BrowserWindowOpener( resource );
        webPageOpener.setWindowName( "Person ID: " + personUuid.getValue() );  // Set title of the new window to be opened.
        String param = "person_id";
        webPageOpener.setParameter( param , personUuid.getValue() );
        String windowFeaturesString = String.format( "width=%d,height=%d,resizable" , Page.getCurrent().getBrowserWindowWidth() , Page.getCurrent().getBrowserWindowHeight() ); // Same size as original window.
        webPageOpener.setFeatures( windowFeaturesString );  // Example: "width=800,height=600,resizable".
        webPageOpener.extend( webPageButton ); // Connect opener with button.
        System.out.println( "TRACE BrowserWindowOpener URL: " + webPageOpener.getUrl() );

        layout.addComponents( personUuid , webPageButton );
        setContent( layout );

        // A request handler for generating some content
        VaadinSession.getCurrent().addRequestHandler(
                new RequestHandler() {
                    @Override
                    public boolean handleRequest ( VaadinSession session ,
                                                   VaadinRequest request ,
                                                   VaadinResponse response )
                            throws IOException {
                        if ( "/person.html".equals( request.getPathInfo() ) ) {
                            // Retrieve the hex-string of the UUID from the URL’s query string parameter.
                            String uuidString = request.getParameter( "person_id" );  // In real-work, validate the results here.
                            UUID uuid = UUID.fromString( uuidString ); // Reconstitute a `UUID` object from that hex-string. In real-work, validate the results here.
                            System.out.println( "UUID object reconstituted from string passed as parameter in query string of URL opened in new window: " + uuid );
                            // Build HTML.
                            String html = renderHtml( uuid );
                            // Send out the generated text as HTML, in UTF-8 character encoding.
                            response.setContentType( "text/html; charset=utf-8" );
                            response.getWriter().append( html );
                            return true; // We wrote a response
                        } else
                            return false; // No response was written
                    }
                } );
    }

    // Generate the HTML to report on the details of a `person` from the database, given the UUID of that database row.
    private String renderHtml ( UUID uuid ) {
        String eol = "\n"; // End-of-line character(s) to use in the HTML.
        StringBuilder html = new StringBuilder();
        html.append( "<!DOCTYPE html>" ).append( eol );
        html.append( "<html>" ).append( eol );
        html.append( "<head>" ).append( eol );
        html.append( "<title>Person</title>" ).append( eol );
        html.append( "</head>" ).append( eol );
        html.append( "<body style='color:DarkSlateGray' >" ).append( eol );
        html.append( "<h1>Demo</h1>" ).append( eol );
        html.append( "<p>This is a drill. This is only a drill.</p>" ).append( eol );
        html.append( "<p>If this had been a real application, you would have seen some data.</p>" ).append( eol );
        html.append( "<p>Person ID: " ).append( uuid.toString() ).append( ".</p>" ).append( eol );
        html.append( "<p style='color:DimGray ; font-family: Pragmata , Hack , Menlo , monospace' >Report generated " ).append( Instant.now() ).append( ".</p>" ).append( eol );
        html.append( "</body>" ).append( eol );
        html.append( "</html>" ).append( eol );
        String s = html.toString();
        System.out.println( "\n\n" + s + "\n\n" );
        return s;
    }

    @WebServlet ( urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true )
    @VaadinServletConfiguration ( ui = MyUI.class, productionMode = false )
    public static class MyUIServlet extends VaadinServlet {
    }
}

这篇关于从Vaadin 8应用程序生成HTML页面,并在新窗口中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆