hello.jsp
<%@ page language="java" contentType="text/html;
charset=GB2312"
pageEncoding="GB2312"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=GB2312">
<title>Struts Demo</title>
</head>
<body>
<H1>Hell, ${userInfo["username"]} !</H1>
</body>
</html>
2.建立数据库表
create table us (id int(10) primary key auto_increment, name
varchar(20))type=innodb;
insert into us (name) values("zhaoyuan");
3.创建 User.java
package edu.bjtu.zhao.ssh;
public class User {
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}