package srever; public class Users { private String username; private String password; public Users() { } 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; } } 建立一个jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="srever.Users" %> <!DOCTYPE html> <html> <head> <meta charset="ISO-8859-1"> <title>Insert title here</title> </head> <body> <% Users user=new Users(); user.setUsername("admin"); user.setPassword("123456"); %> <h1>使用普通方式创建javabean的实例</h1><br> 用户名:<%=user.getUsername() %><br> 密码:<%=user.getPassword() %><br> </body> </html>