Javabeans

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

<html>

    
    <title>Codemiles :JSP Form with Java Beans </title>
    <body>
        
        <form action="afterindex.jsp" >
            
             
  <p>First name: <input type="text" name="firstName" size=30>
  <br>Last name: <input type="text" name="lastName" size=30>
  <br>Email: <input type="text" name="email" size=30>

  <p><input type="submit" name="Submit">
        </form>
    </body>
</html>

<%@ page import="codemiles.Userentry"%>
<%@ page import="codemiles.Userentry"%>
<jsp:useBean id="EntryBean" class="codemiles.Userentry" 
type="Userentry" scope="application" />
<jsp:setProperty name="EntryBean" property="*"/>

<html>
    
    <body>
        <b>
            Your data has been submitted 
        </b>
    </body>
</html> 

package codemiles;

/**
 *
 * @author codemiles Team
 */
public class Userentry {
    String firstName;
    String lastName;
    String email;

    public void setEmail(String email) {
        this.email = email;
        System.out.println(email);
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
        System.out.println(firstName);
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
        System.out.println(lastName);
    }
    public String getEmail() {
        return email;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }
    

You might also like