CODE:
login.xhtml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="https://xmlns.jcp.org/jsf/html">
<h:head>
<title>Student Registration Form</title>
</h:head>
<h:body>
<h:form>
First name: <h:inputText id="firstName" value="#{String.firstName}" />
<br/><br/>
Last name: <h:inputText id="lastName" value="#{String.lastName}" />
<br/><br/>
<h:commandButton value="Submit" action="String_response" />
</h:form>
</h:body>
</html>
String.java code:
package com.login;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class String {
private String firstName;
private String lastName;
public string() {
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName=firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastname) {
this.lastName=lastName;
}
}
form_response code:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Student Confirmation</title>
</h:head>
<h:body>
The student is confirmed: #{String.firstName} #{String.lastName}
</h:body>
</html>
OUTPUT: