title: Accessing java beans from html5
body: <p>I'm building a website in html which uses Java server faces to access a Java bean. I have got it to work using xhtml but i realised that i need some functionality from html5 so i'm trying to rebuild the front-end using html5. </p>
  
  <p>The working index.xhtml</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"&gt;
  &lt;body&gt;
  &lt;h:form&gt;
          username:
          &lt;h:inputText id="userName" size="10" maxlength="20" value="#{LoginBean.username}"/&gt;
          &lt;br&gt;&lt;/br&gt;
          password:
          &lt;h:inputText id="password" size="10" maxlength="20" value="#{LoginBean.password}"/&gt;
          &lt;br&gt;&lt;/br&gt;
          &lt;h:commandButton id="submit" value="submit" action="#{LoginBean.login()}"/&gt;
          &lt;br&gt;&lt;/br&gt;
      &lt;/h:form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>The bean LoginBean.java</p>
  
  <pre><code>@ManagedBean(name = "LoginBean")
  @SessionScoped
  public class LoginBean
  {
  String username;
  String password;
  
  public String login() throws Exception
  {
      Scanner s = new Scanner(new URL("http://172.17.0.3:8080/login?username=" + username + "&amp;password=" + password).openStream(), "UTF-8").useDelimiter("\\A");
      String out = s.next();
      s.close();
      Boolean bool = new Gson().fromJson(out, Boolean.class);
  
      if (bool)
      {
          return "userPage";
      } else
      {
          return "index";
      }
  }
  
  public String getUsername()
  {
      return username;
  }
  
  public void setUsername(String username)
  {
      this.username = username;
  }
  
  public String getPassword()
  {
      return password;
  }
  
  public void setPassword(String password)
  {
      this.password = password;
  }
  }
  </code></pre>
  
  <p>The button is supposed to save the username and password and if 172.17.0.3:8080/login accepts the login then the UserPage.html is supposed to load. So is it possible to do the same thing in html5?</p>