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.
The working index.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<body>
<h:form>
username:
<h:inputText id="userName" size="10" maxlength="20" value="#{LoginBean.username}"/>
<br></br>
password:
<h:inputText id="password" size="10" maxlength="20" value="#{LoginBean.password}"/>
<br></br>
<h:commandButton id="submit" value="submit" action="#{LoginBean.login()}"/>
<br></br>
</h:form>
</body>
The bean LoginBean.java
@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 + "&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;
}
}
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?