{"id":35697,"date":"2016-04-04T15:00:44","date_gmt":"2016-04-04T12:00:44","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=35697"},"modified":"2019-04-09T13:21:57","modified_gmt":"2019-04-09T10:21:57","slug":"vaadin-login-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/","title":{"rendered":"Vaadin Login Example"},"content":{"rendered":"<p>A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and the public nature of the Internet make the user authentication a vital part of any web application. In this example I am going to show you how to implement a login form in Vaadin to protect the secure part of a web application.<\/p>\n<h2>1. The tools<\/h2>\n<ul>\n<li>Java JDK 8<\/li>\n<li>Latest Eclipse Mars<\/li>\n<li>Vaadin 7.6.4<\/li>\n<li>Tomcat Server 8<\/li>\n<\/ul>\n<h2>2. Introduction<\/h2>\n<p>A login is a special form that collects user credentials and communicates with an authentication mechanism to check the validity of the credentials, then if the credentials are valid the user is routed to a secure area else if the credentials are invalid the page keep asking for a valid input, there are a multiples approach to this problem.<\/p>\n<p>You can define the number of times a user can retry for invalid credentials from a single username, a browser user-agent, an IP, a mac address, cookies and other user guessing identification methods, you can use MD5 to hash your credentials but the security of the MD5 hash function is severely compromised. The best approach nowadays is to use the HTTP over SSL (https) protocol that create a secure channel over an insecure network for your web application. Vaadin offers a navigation mechanism to manage your views, using that I constructed the login form, in older versions of Vaadin have a LoginForm class but from version 7 and up LoginForm is deprecated.<\/p>\n<h2>3. Prerequisites<\/h2>\n<ul>\n<li>JDK installed<\/li>\n<li>Eclipse Mars installed and working<\/li>\n<li>Vaadin 7.6.4 plugin installed<\/li>\n<li>Tomcat 8 installed and running<\/li>\n<\/ul>\n<h2>4. Set up the project<\/h2>\n<p>In the file menu choose File -&gt; New -&gt; Other:<\/p>\n<p><figure id=\"attachment_34378\" aria-describedby=\"caption-attachment-34378\" style=\"width: 646px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1.png\" rel=\"attachment wp-att-34378\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1.png\" alt=\"01 New Project\" width=\"646\" height=\"422\" class=\"size-full wp-image-34378\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1.png 646w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/01-New-Project-1-300x196.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/a><figcaption id=\"caption-attachment-34378\" class=\"wp-caption-text\">01 New Project<\/figcaption><\/figure><\/p>\n<p>Now from the list choose Vaadin 7 project:<\/p>\n<p><figure id=\"attachment_34379\" aria-describedby=\"caption-attachment-34379\" style=\"width: 524px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1.png\" rel=\"attachment wp-att-34379\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1.png\" alt=\"02 Vaadin Project\" width=\"524\" height=\"499\" class=\"size-full wp-image-34379\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1.png 524w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/02-Vaadin-Project-1-300x286.png 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/a><figcaption id=\"caption-attachment-34379\" class=\"wp-caption-text\">02 Vaadin Project<\/figcaption><\/figure><\/p>\n<p>Hit next and name your project then hit finish.<\/p>\n<h2>5. Coding the example<\/h2>\n<h3>5.1 Mockup Authentication class<\/h3>\n<p>Lets create a mockup authentication class that handle the backend authentication with only one user, you can change it to any needed mechanism.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Authentication.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinlogin;\n\npublic class Authentication {\n\t\n\tprivate String username;\n\tprivate String password;\n\t\n\tpublic Authentication() {\n\t\tsetUsername(\"myuser\");\n\t\tsetPassword(\"mypass\");\n\t}\n\n\tprivate void setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\t\n\tprivate String getUsername(){\n\t\treturn this.username;\n\t}\n\n\tprivate void setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\t\n\tprivate String getPassword(){\n\t\treturn this.password;\n\t}\n\t\n\tpublic Boolean authenticate(String username, String password){\n\t\tif(username.equals(getUsername()) &amp;&amp; password.equals(getPassword())){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n}\n<\/pre>\n<p>This class have two private <code>String<\/code> fields for the user and the password, also have the boilerplate setter and getter and a method <code>public Boolean authenticate(String username, String password)<\/code> that receive two strings as parameters and returns true if the credentials correspond with the mockup user created, here you have space to plug a database or whatever backend you choose to store your users credentials.<\/p>\n<h3>5.2 Login Page<\/h3>\n<p>Let&#8217;s build the login page:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Layout<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class LoginPage extends VerticalLayout implements View {\n\tprivate static final long serialVersionUID = 1L;\n\tpublic static final String NAME = \"\";\n<\/pre>\n<p>The login page extends <code>VerticalLayout<\/code> to place our components and implements <code>View<\/code> to use a <code>Navigator<\/code>, more on this later, and have a field <code>NAME<\/code> to use also in the navigation flow of the application.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Login Panel<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tPanel panel = new Panel(\"Login\");\n\t\tpanel.setSizeUndefined();\n\t\taddComponent(panel);\n<\/pre>\n<p>The fields of the login form are inside a <code>Panel<\/code> so create the panel and add it to the layout.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Login Form<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tFormLayout content = new FormLayout();\n\t\tTextField username = new TextField(\"Username\");\n\t\tcontent.addComponent(username);\n\t\tPasswordField password = new PasswordField(\"Password\");\n\t\tcontent.addComponent(password);\n<\/pre>\n<p>Inside the panel there is a form with a <code>TextField<\/code> for the username, a <code>PasswordField<\/code> that is a special kind of text field that allows to hide the user input, the password field is used for the password, I add both fields to the <code>FormLayout content<\/code>.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Button Send<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tButton send = new Button(\"Enter\");\n\t\tsend.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tif(VaadinloginUI.AUTH.authenticate(username.getValue(), password.getValue())){\n\t\t\t\t\tVaadinSession.getCurrent().setAttribute(\"user\", username.getValue());\n\t\t\t\t\tgetUI().getNavigator().addView(SecurePage.NAME, SecurePage.class);\n\t\t\t\t\tgetUI().getNavigator().addView(OtherSecurePage.NAME, OtherSecurePage.class);\n\t\t\t\t\tPage.getCurrent().setUriFragment(\"!\"+SecurePage.NAME);\n\t\t\t\t}else{\n\t\t\t\t\tNotification.show(\"Invalid credentials\", Notification.Type.ERROR_MESSAGE);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t});\n\n<\/pre>\n<p>I created a <code>Button<\/code> to check the credentials against the mockup authentication class. The button have a <code>ClickListener()<\/code> and when the button is pressed, the following things happen: <code>VaadinloginUI.AUTH.authenticate<\/code> check the credentials, if the credentials are incorrect a <code>Notification<\/code> is show, is better not to specify what credential is wrong so is a general message with invalid credentials, if the credentials are correct then set the user in the session to keep logged in between page refresh, next add two more views to the navigator. These view are private and you need to be logged to access them and last redirect the page using setting a uri fragment. In this case the uri fragment correspond to the last part of the uri after the &#8220;#&#8221; character, so I am using the name defined in the page to navigate to that page.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Add components<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tcontent.addComponent(send);\n\t\tcontent.setSizeUndefined();\n\t\tcontent.setMargin(true);\n\t\tpanel.setContent(content);\n\t\tsetComponentAlignment(panel, Alignment.MIDDLE_CENTER);\n<\/pre>\n<p>Add the components to the layout and set the panel alignment to the center as is usual in login forms but you can put it on any place of the page.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h3>5.3 Secure page<\/h3>\n<p>The secure page is a page to show the private area behavior, in the private area you can have all the pages you need.<\/p>\n<p><span style=\"text-decoration: underline\"><em>The layout<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class SecurePage extends VerticalLayout implements View {\n\tprivate static final long serialVersionUID = 1L;\n\tprivate Label secure;\n\tprivate Label currentUser;\n\tprivate Button otherSecure;\n\tprivate Button logout;\n\tpublic static final String NAME = \"Secure\";\n<\/pre>\n<p>As before this page use a vertical layout to put the components, it have two labels and two buttons, the label <code>currentUser<\/code> is used to show the user logged in the application, it have a button to go to the other secure page and a button to logout.<\/p>\n<p><span style=\"text-decoration: underline\"><em>otherSecure Button<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\totherSecure = new Button(\"OtherSecure\");\n\t\totherSecure.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tPage.getCurrent().setUriFragment(\"!\"+OtherSecurePage.NAME);\n\t\t\t}\n\t\t});\n\n<\/pre>\n<p>The <code>otherSecure<\/code> button is used to navigate to the other private page used in this example, the navigation is done using <code>Page.getCurrent().setUriFragment(\"!\"+OtherSecurePage.NAME);<\/code> that change the uri fragment as before.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Logout button<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tlogout = new Button(\"Logout\");\n\t\tlogout.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tgetUI().getNavigator().removeView(SecurePage.NAME);\n\t\t\t\tgetUI().getNavigator().removeView(OtherSecurePage.NAME);\n\t\t\t\tVaadinSession.getCurrent().setAttribute(\"user\", null);\n\t\t\t\tPage.getCurrent().setUriFragment(\"\");\n\t\t\t}\n\t\t});\n<\/pre>\n<p>The logout button first remove the secure page view with <code>getUI().getNavigator().removeView(SecurePage.NAME);<\/code>, remove the other secure page with <code>getUI().getNavigator().removeView(OtherSecurePage.NAME);<\/code>, clean the session with <code>VaadinSession.getCurrent().setAttribute(\"user\", null);<\/code> and clean the uri fragment to change the current page to the login page, removing the views prevent it to be accessible from the navigator.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Place the components<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tsecure = new Label(\"secure\");\n\t\tcurrentUser = new Label(\"Current User\");\n\t\taddComponent(secure);\n\t\taddComponent(currentUser);\n\t\taddComponent(otherSecure);\n\t\taddComponent(logout);\n<\/pre>\n<p>Add the components to the layout to show them.<\/p>\n<p><span style=\"text-decoration: underline\"><em>enter<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t@Override\n\tpublic void enter(ViewChangeEvent event) {\n\t\tcurrentUser.setCaption(\"Current user : \" + VaadinSession.getCurrent().getAttribute(\"user\").toString()); \n\n\t}\n<\/pre>\n<p>This event is always called before the view is shown to the screen, here I get the username from the session and show it in the currentUser label.<\/p>\n<h3>5.4 OtherSecure page<\/h3>\n<p><span style=\"text-decoration: underline\"><em>OtherSecure page<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class OtherSecurePage extends VerticalLayout implements View{\n\n\tprivate static final long serialVersionUID = 1L;\n\tprivate Label otherSecure;\n\tpublic static final String NAME = \"OtherSecure\";\n\tprivate Button mainsecure;\n\n\tpublic OtherSecurePage() {\n\t\tmainsecure = new Button(\"Main Secure Area\");\n\t\tmainsecure.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tPage.getCurrent().setUriFragment(\"!\"+SecurePage.NAME);\n\t\t\t}\n\t\t});\n\t\totherSecure = new Label(\"Other Secure Page ...\");\n\t\taddComponent(otherSecure);\n\t\taddComponent(mainsecure);\n\t}\n\t@Override\n\tpublic void enter(ViewChangeEvent event) {\n\t\t\n\t}\n\n}\n<\/pre>\n<p>This page only have one button that send the user to the secure page, is made here to the purpose of show how to handle multiples pages inside the secure area, usually is a better idea to make a navigation menu and inside the navigation menu put all your pages, to avoid make a navigation widget for every page but everything here depends on your design, remember if the design is bad the rest is bad too so a solid rock design is the bullet proof foundation of your program.<\/p>\n<h3>5.5 The main UI<\/h3>\n<p><span style=\"text-decoration: underline\"><em>Init<\/em><\/span><\/p>\n<pre class=\"brush:java\">\tpublic static Authentication AUTH;\n\t@Override\n\tprotected void init(VaadinRequest request) {\n\t\tAUTH = new Authentication();\n\t\tnew Navigator(this, this);\n<\/pre>\n<p>Ok here I declared an static <code>AUTH<\/code> variable to store an instance of the <code>Authentication<\/code> class and create a <code>Navigator(this, this)<\/code>, the navigator is a class that tracks the active view using URI fragments, is in charge of show the current view and store a record and change the other views.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Initial page<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tgetNavigator().addView(LoginPage.NAME, LoginPage.class);\n\t\tgetNavigator().setErrorView(LoginPage.class);\n<\/pre>\n<p>Using the navigator, add the login page as a view and set the error page, the error view is a page that is redirected when an error occurs in the application. In this case I used the same login page as an error view, just to no create another dummy page and the login page is public and if any error raise in the application I don&#8217;t want a user hanging in the private area, the error page is a design topic, where you need it and how.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Uri fragment listener<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\tPage.getCurrent().addUriFragmentChangedListener(new UriFragmentChangedListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void uriFragmentChanged(UriFragmentChangedEvent event) {\n\t\t\t\trouter(event.getUriFragment());\n\t\t\t}\n\t\t});\n\t\trouter(\"\");\n<\/pre>\n<p>To know when the uri fragment changes we have this listener so every time the uri fragment is modified the router function is called with the new uri fragment as a parameter, and finally I call the router with a empty string to redirect the page to the login page.<\/p>\n<p><span style=\"text-decoration: underline\"><em>router method<\/em><\/span><\/p>\n<pre class=\"brush:java\">\tprivate void router(String route){\n\t\tNotification.show(route);\n\t\tif(getSession().getAttribute(\"user\") != null){\n\t\t\tgetNavigator().addView(SecurePage.NAME, SecurePage.class);\n\t\t\tgetNavigator().addView(OtherSecurePage.NAME, OtherSecurePage.class);\n\t\t\tif(route.equals(\"!OtherSecure\")){\n\t\t\t\tgetNavigator().navigateTo(OtherSecurePage.NAME);\n\t\t\t}else{\n\t\t\t\tgetNavigator().navigateTo(SecurePage.NAME);\n\t\t\t}\n\t\t}else{\n\t\t\tgetNavigator().navigateTo(LoginPage.NAME);\n\t\t}\n\t}\n\n<\/pre>\n<p>This router method is in charge of the page flow. Every time the uri changes the application call this method and using the navigator change the page to the correct one. If the user is no logged and try to navigate to an in-existent page this router shows the login page and in the case the user is logged in the the router navigate to the secure page by default, so it checks the session with <code>if(getSession().getAttribute(\"user\") != null)<\/code>. If no user is in the session then show the login page and if the user is in the session navigate to the secure area, this can be done because the session is stored server side and because you are handling the user in the server is safe to navigate in this way. You can use cookies for user authentication too but is not recommended because cookies are stored client side and can be forged by malicious users.[ulp id=&#8217;YBvYYzEYBUrADqmI&#8217;]<\/p>\n<h2>6. The complete source code<\/h2>\n<p><span style=\"text-decoration: underline\"><em>VaadinloginUI.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinlogin;\n\nimport javax.servlet.annotation.WebServlet;\n\nimport com.vaadin.annotations.Theme;\nimport com.vaadin.annotations.VaadinServletConfiguration;\nimport com.vaadin.navigator.Navigator;\nimport com.vaadin.server.Page;\nimport com.vaadin.server.Page.UriFragmentChangedEvent;\nimport com.vaadin.server.Page.UriFragmentChangedListener;\nimport com.vaadin.server.VaadinRequest;\nimport com.vaadin.server.VaadinServlet;\nimport com.vaadin.ui.Notification;\nimport com.vaadin.ui.UI;\n\n@SuppressWarnings(\"serial\")\n@Theme(\"vaadinlogin\")\npublic class VaadinloginUI extends UI {\n\n\t@WebServlet(value = \"\/*\", asyncSupported = true)\n\t@VaadinServletConfiguration(productionMode = false, ui = VaadinloginUI.class)\n\tpublic static class Servlet extends VaadinServlet {\n\t}\n\n\tpublic static Authentication AUTH;\n\t@Override\n\tprotected void init(VaadinRequest request) {\n\t\tAUTH = new Authentication();\n\t\tnew Navigator(this, this);\n\t\t\n\t\tgetNavigator().addView(LoginPage.NAME, LoginPage.class);\n\t\tgetNavigator().setErrorView(LoginPage.class);\n\t\t\n\t\tPage.getCurrent().addUriFragmentChangedListener(new UriFragmentChangedListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void uriFragmentChanged(UriFragmentChangedEvent event) {\n\t\t\t\trouter(event.getUriFragment());\n\t\t\t}\n\t\t});\n\t\t\n\t\t\n\t\trouter(\"\");\n\t}\n\t\n\tprivate void router(String route){\n\t\tNotification.show(route);\n\t\tif(getSession().getAttribute(\"user\") != null){\n\t\t\tgetNavigator().addView(SecurePage.NAME, SecurePage.class);\n\t\t\tgetNavigator().addView(OtherSecurePage.NAME, OtherSecurePage.class);\n\t\t\tif(route.equals(\"!OtherSecure\")){\n\t\t\t\tgetNavigator().navigateTo(OtherSecurePage.NAME);\n\t\t\t}else{\n\t\t\t\tgetNavigator().navigateTo(SecurePage.NAME);\n\t\t\t}\n\t\t}else{\n\t\t\tgetNavigator().navigateTo(LoginPage.NAME);\n\t\t}\n\t}\n\n}\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>LoginPage.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinlogin;\n\nimport com.vaadin.navigator.View;\nimport com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\nimport com.vaadin.server.Page;\nimport com.vaadin.server.VaadinSession;\nimport com.vaadin.ui.Alignment;\nimport com.vaadin.ui.Button;\nimport com.vaadin.ui.Button.ClickEvent;\nimport com.vaadin.ui.Button.ClickListener;\nimport com.vaadin.ui.FormLayout;\nimport com.vaadin.ui.Notification;\nimport com.vaadin.ui.Panel;\nimport com.vaadin.ui.PasswordField;\nimport com.vaadin.ui.TextField;\nimport com.vaadin.ui.VerticalLayout;\n\npublic class LoginPage extends VerticalLayout implements View {\n\tprivate static final long serialVersionUID = 1L;\n\tpublic static final String NAME = \"\";\n\n\tpublic LoginPage(){\n\t\tPanel panel = new Panel(\"Login\");\n\t\tpanel.setSizeUndefined();\n\t\taddComponent(panel);\n\n\t\t\n\t\tFormLayout content = new FormLayout();\n\t\tTextField username = new TextField(\"Username\");\n\t\tcontent.addComponent(username);\n\t\tPasswordField password = new PasswordField(\"Password\");\n\t\tcontent.addComponent(password);\n\n\t\tButton send = new Button(\"Enter\");\n\t\tsend.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tif(VaadinloginUI.AUTH.authenticate(username.getValue(), password.getValue())){\n\t\t\t\t\tVaadinSession.getCurrent().setAttribute(\"user\", username.getValue());\n\t\t\t\t\tgetUI().getNavigator().addView(SecurePage.NAME, SecurePage.class);\n\t\t\t\t\tgetUI().getNavigator().addView(OtherSecurePage.NAME, OtherSecurePage.class);\n\t\t\t\t\tPage.getCurrent().setUriFragment(\"!\"+SecurePage.NAME);\n\t\t\t\t}else{\n\t\t\t\t\tNotification.show(\"Invalid credentials\", Notification.Type.ERROR_MESSAGE);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t});\n\t\tcontent.addComponent(send);\n\t\tcontent.setSizeUndefined();\n\t\tcontent.setMargin(true);\n\t\tpanel.setContent(content);\n\t\tsetComponentAlignment(panel, Alignment.MIDDLE_CENTER);\n\t\n\t}\n\t\n\t@Override\n\tpublic void enter(ViewChangeEvent event) {\n\t\t\n\t}\n\n}\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>SecurePage.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinlogin;\n\nimport com.vaadin.navigator.View;\nimport com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\nimport com.vaadin.server.Page;\nimport com.vaadin.server.VaadinSession;\nimport com.vaadin.ui.Button;\nimport com.vaadin.ui.Button.ClickEvent;\nimport com.vaadin.ui.Button.ClickListener;\nimport com.vaadin.ui.Label;\nimport com.vaadin.ui.VerticalLayout;\n\npublic class SecurePage extends VerticalLayout implements View {\n\tprivate static final long serialVersionUID = 1L;\n\tprivate Label secure;\n\tprivate Label currentUser;\n\tprivate Button otherSecure;\n\tprivate Button logout;\n\tpublic static final String NAME = \"Secure\";\n\n\tpublic SecurePage() {\n\t\t\n\t\totherSecure = new Button(\"OtherSecure\");\n\t\totherSecure.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tPage.getCurrent().setUriFragment(\"!\"+OtherSecurePage.NAME);\n\t\t\t}\n\t\t});\n\t\t\n\t\tlogout = new Button(\"Logout\");\n\t\tlogout.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tgetUI().getNavigator().removeView(SecurePage.NAME);\n\t\t\t\tgetUI().getNavigator().removeView(OtherSecurePage.NAME);\n\t\t\t\tVaadinSession.getCurrent().setAttribute(\"user\", null);\n\t\t\t\tPage.getCurrent().setUriFragment(\"\");\n\t\t\t}\n\t\t});\n\t\t\n\t\tsecure = new Label(\"secure\");\n\t\tcurrentUser = new Label(\"Current User\");\n\t\taddComponent(secure);\n\t\taddComponent(currentUser);\n\t\taddComponent(otherSecure);\n\t\taddComponent(logout);\n\t}\n\n\t@Override\n\tpublic void enter(ViewChangeEvent event) {\n\t\tcurrentUser.setCaption(\"Current user : \" + VaadinSession.getCurrent().getAttribute(\"user\").toString()); \n\n\t}\n\n}\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>OtherSecurePage.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinlogin;\n\nimport com.vaadin.navigator.View;\nimport com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;\nimport com.vaadin.server.Page;\nimport com.vaadin.ui.Button;\nimport com.vaadin.ui.Label;\nimport com.vaadin.ui.VerticalLayout;\nimport com.vaadin.ui.Button.ClickEvent;\nimport com.vaadin.ui.Button.ClickListener;\n\npublic class OtherSecurePage extends VerticalLayout implements View{\n\n\tprivate static final long serialVersionUID = 1L;\n\tprivate Label otherSecure;\n\tpublic static final String NAME = \"OtherSecure\";\n\tprivate Button mainsecure;\n\n\tpublic OtherSecurePage() {\n\t\tmainsecure = new Button(\"Main Secure Area\");\n\t\tmainsecure.addClickListener(new ClickListener() {\n\t\t\tprivate static final long serialVersionUID = 1L;\n\n\t\t\t@Override\n\t\t\tpublic void buttonClick(ClickEvent event) {\n\t\t\t\tPage.getCurrent().setUriFragment(\"!\"+SecurePage.NAME);\n\t\t\t}\n\t\t});\n\t\totherSecure = new Label(\"Other Secure Page ...\");\n\t\taddComponent(otherSecure);\n\t\taddComponent(mainsecure);\n\t}\n\t@Override\n\tpublic void enter(ViewChangeEvent event) {\n\t\t\n\t}\n\n}\n<\/pre>\n<p><span style=\"text-decoration: underline\"><em>Authentication.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.vaadinlogin;\n\npublic class Authentication {\n\t\n\tprivate String username;\n\tprivate String password;\n\t\n\tpublic Authentication() {\n\t\tsetUsername(\"myuser\");\n\t\tsetPassword(\"mypass\");\n\t}\n\n\tprivate void setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\t\n\tprivate String getUsername(){\n\t\treturn this.username;\n\t}\n\n\tprivate void setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\t\n\tprivate String getPassword(){\n\t\treturn this.password;\n\t}\n\t\n\tpublic Boolean authenticate(String username, String password){\n\t\tif(username.equals(getUsername()) &amp;&amp; password.equals(getPassword())){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n}\n<\/pre>\n<h2>7. Running the example<\/h2>\n<p>Right click on the project folder and choose Run as -&gt; Run on server choose Tomcat 8 server and hit finish.<\/p>\n<h2>8. Results<\/h2>\n<p>Failed Login:<\/p>\n<p><figure id=\"attachment_35709\" aria-describedby=\"caption-attachment-35709\" style=\"width: 451px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/03-Login-Form-Failed-Login.png\" rel=\"attachment wp-att-35709\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/03-Login-Form-Failed-Login.png\" alt=\"03 Login Form Failed Login\" width=\"451\" height=\"352\" class=\"size-full wp-image-35709\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/03-Login-Form-Failed-Login.png 451w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/03-Login-Form-Failed-Login-300x234.png 300w\" sizes=\"(max-width: 451px) 100vw, 451px\" \/><\/a><figcaption id=\"caption-attachment-35709\" class=\"wp-caption-text\">03 Login Form Failed Login<\/figcaption><\/figure><\/p>\n<p>Filled Login:<\/p>\n<p><figure id=\"attachment_35710\" aria-describedby=\"caption-attachment-35710\" style=\"width: 423px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/04-Login-Form-Filled.png\" rel=\"attachment wp-att-35710\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/04-Login-Form-Filled.png\" alt=\"04 Login Form Filled\" width=\"423\" height=\"283\" class=\"size-full wp-image-35710\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/04-Login-Form-Filled.png 423w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/04-Login-Form-Filled-300x201.png 300w\" sizes=\"(max-width: 423px) 100vw, 423px\" \/><\/a><figcaption id=\"caption-attachment-35710\" class=\"wp-caption-text\">04 Login Form Filled<\/figcaption><\/figure><\/p>\n<p>Secure Page:<\/p>\n<p><figure id=\"attachment_35711\" aria-describedby=\"caption-attachment-35711\" style=\"width: 401px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/05-Secure-Page.png\" rel=\"attachment wp-att-35711\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/05-Secure-Page.png\" alt=\"05 Secure Page\" width=\"401\" height=\"251\" class=\"size-full wp-image-35711\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/05-Secure-Page.png 401w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/05-Secure-Page-300x188.png 300w\" sizes=\"(max-width: 401px) 100vw, 401px\" \/><\/a><figcaption id=\"caption-attachment-35711\" class=\"wp-caption-text\">05 Secure Page<\/figcaption><\/figure><\/p>\n<p>The Other Secure Page:<\/p>\n<p><figure id=\"attachment_35712\" aria-describedby=\"caption-attachment-35712\" style=\"width: 374px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/06-Other-Secure-Page.png\" rel=\"attachment wp-att-35712\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/06-Other-Secure-Page.png\" alt=\"06 Other Secure Page\" width=\"374\" height=\"144\" class=\"size-full wp-image-35712\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/06-Other-Secure-Page.png 374w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/06-Other-Secure-Page-300x116.png 300w\" sizes=\"(max-width: 374px) 100vw, 374px\" \/><\/a><figcaption id=\"caption-attachment-35712\" class=\"wp-caption-text\">06 Other Secure Page<\/figcaption><\/figure><\/p>\n<h2>9. Download the Source Code<\/h2>\n<p>This was an example of Vaadin Login.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the Eclipse project here: <strong><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/04\/VaadinLogin.zip\">VaadinLogin<\/a><\/strong><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and the public nature of the Internet make the user authentication a vital part of any web application. In this example I am going to show you how to implement &hellip;<\/p>\n","protected":false},"author":77,"featured_media":33079,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1358],"tags":[],"class_list":["post-35697","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vaadin"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Vaadin Login Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Vaadin Login Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-04T12:00:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-09T10:21:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jesus Boadas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@jboadas\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jesus Boadas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\"},\"author\":{\"name\":\"Jesus Boadas\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7\"},\"headline\":\"Vaadin Login Example\",\"datePublished\":\"2016-04-04T12:00:44+00:00\",\"dateModified\":\"2019-04-09T10:21:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\"},\"wordCount\":1433,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"articleSection\":[\"Vaadin\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\",\"name\":\"Vaadin Login Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"datePublished\":\"2016-04-04T12:00:44+00:00\",\"dateModified\":\"2019-04-09T10:21:57+00:00\",\"description\":\"A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Vaadin\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/vaadin\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Vaadin Login Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7\",\"name\":\"Jesus Boadas\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg\",\"caption\":\"Jesus Boadas\"},\"description\":\"I'm a self taught programmer, I began programming back in 1991 using an IBM A10 mainframe with Pascal an Assembler IBM 360\/70 emulator and Turbo C on a X86 PC, since that I work for the banking industry with emerging technologies like Fox Pro, Visual Fox Pro, Visual Basic, Visual C++, Borland C++, lately I moved out to the Airline industry, leading designing and programming in-house web applications with Flex, Actionscript, PHP, Python and Rails and in the last 7 years I focused all my work in Java, working on Linux servers using GlassFish, TomCat, Apache and MySql.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\",\"https:\/\/ve.linkedin.com\/in\/jesus-boadas\",\"https:\/\/x.com\/jboadas\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/jesus-boadas\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Vaadin Login Example - Java Code Geeks","description":"A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/","og_locale":"en_US","og_type":"article","og_title":"Vaadin Login Example - Java Code Geeks","og_description":"A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-04-04T12:00:44+00:00","article_modified_time":"2019-04-09T10:21:57+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","type":"image\/jpeg"}],"author":"Jesus Boadas","twitter_card":"summary_large_image","twitter_creator":"@jboadas","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Jesus Boadas","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/"},"author":{"name":"Jesus Boadas","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7"},"headline":"Vaadin Login Example","datePublished":"2016-04-04T12:00:44+00:00","dateModified":"2019-04-09T10:21:57+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/"},"wordCount":1433,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","articleSection":["Vaadin"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/","name":"Vaadin Login Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","datePublished":"2016-04-04T12:00:44+00:00","dateModified":"2019-04-09T10:21:57+00:00","description":"A login form is used to process user authentication in a web application.Ccontrary to web pages, web applications could be a complex piece of software and","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/01\/vaadin-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/enterprise-java\/vaadin\/vaadin-login-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/"},{"@type":"ListItem","position":4,"name":"Vaadin","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/enterprise-java\/vaadin\/"},{"@type":"ListItem","position":5,"name":"Vaadin Login Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/506f9c2b38156c7f94bba77757206dd7","name":"Jesus Boadas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/10\/Jesus-Boadas_avatar_1476120926-96x96.jpg","caption":"Jesus Boadas"},"description":"I'm a self taught programmer, I began programming back in 1991 using an IBM A10 mainframe with Pascal an Assembler IBM 360\/70 emulator and Turbo C on a X86 PC, since that I work for the banking industry with emerging technologies like Fox Pro, Visual Fox Pro, Visual Basic, Visual C++, Borland C++, lately I moved out to the Airline industry, leading designing and programming in-house web applications with Flex, Actionscript, PHP, Python and Rails and in the last 7 years I focused all my work in Java, working on Linux servers using GlassFish, TomCat, Apache and MySql.","sameAs":["http:\/\/www.javacodegeeks.com\/","https:\/\/ve.linkedin.com\/in\/jesus-boadas","https:\/\/x.com\/jboadas"],"url":"https:\/\/examples.javacodegeeks.com\/author\/jesus-boadas\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/35697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=35697"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/35697\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/33079"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=35697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=35697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=35697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}