0% found this document useful (0 votes)
25 views

Java Ass5

The documents define a Java web application that allows a user to enter their first and last name into a registration form. The form submission is handled by a managed bean class that stores the name values. A response page then displays the full name of the registered student by accessing the name properties of the managed bean.

Uploaded by

boomboomciao049
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Java Ass5

The documents define a Java web application that allows a user to enter their first and last name into a registration form. The form submission is handled by a managed bean class that stores the name values. A response page then displays the full name of the registered student by accessing the name properties of the managed bean.

Uploaded by

boomboomciao049
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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:

You might also like