JavaBean技术与JSP开发模型(用户登录页面的实现)

JavaBean种类

1.在IDEA中创建一个名称为chapter06的Web项目,在src文件夹中创建名称为cn.itcast的包,并在包中创建名称为User的JavaBean对象,用于封装用户信息,具体代码如下

package entity;

public class User {
    private String username;
    private String password;
    private String name;
    private String email;
    private String phone;
    private String address;
    private String isadmin;

    public User() {
    }

    public User(String username, String password, String name, String email, String phone, String address,String isadmin) {
        this.username = username;
        this.password = password;
        this.name = name;
        this.email = email;
        this.phone = phone;
        this.address = address;
        this.isadmin = isadmin;
    }

    //setter and getter
    public String getIsadmin() {
        return isadmin;
    }

    public void setIsadmin(String isadmin) {
        this.isadmin = isadmin;
    }

    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;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

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

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}

2.在项目中的web文件夹下创建名称为login的JSP文件,该用户用于输入并提交用户名和密码。代码的实现如下


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


    
    用户登录页面
    
    
    
    
    


<%--导航栏页面--%>
<%@include file="header.jsp" %>
<%--注册部分--%>

<%--底部信息页面--%>
<%@include file="footer.jsp"%>


3.运行结果如下

JavaBean技术与JSP开发模型(用户登录页面的实现)_第1张图片

 

你可能感兴趣的:(java,开发语言,intellij-idea)