package com.zhuchenxi.entity;
import java.io.Serializable;
public class Dept implements Serializable {
private static final long serialVersionUID = -288611754382387953L;
private Integer deptId;
private String deptName;
public Integer getDeptId() {
return deptId;
}
public void setDeptId(Integer deptId) {
this.deptId = deptId;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@Override
public String toString() {
return "Dept [deptId=" + deptId + ", deptName=" + deptName + "]";
}
public Dept() {
// TODO Auto-generated constructor stub
}
public Dept(Integer deptId, String deptName) {
super();
this.deptId = deptId;
this.deptName = deptName;
}
}
再写一个dao方法
package com.zhuchenxi.dao;
import java.util.ArrayList;
import java.util.List;
import com.zhuchenxi.entity.Dept;
public class DeptDao {
public List list(){
//访问数据库
List ls = new ArrayList();
ls.add(new Dept(1,"好嘞"));
ls.add(new Dept(2,"不累"));
ls.add(new Dept(3,"干了"));
ls.add(new Dept(4,"老子"));
return ls;
}
}
还是老样子写一个SetTag
package com.zhuchenxi.daay3;
import java.util.List;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import com.zhuchenxi.dao.DeptDao;
import com.zhuchenxi.entity.Dept;
public class SetTag extends BodyTagSupport {
private String value;//保存数据的key
private DeptDao deptDao = new DeptDao();
public SetTag() {
// TODO Auto-generated constructor stub
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public DeptDao getDeptDao() {
return deptDao;
}
public void setDeptDao(DeptDao deptDao) {
this.deptDao = deptDao;
}
@Override
public int doStartTag() throws JspException {
List list = deptDao.list();
pageContext.setAttribute(value, list);
return super.doStartTag();
}
}
视图控制层代码demo如下:
@Controller
@RequestMapping("/")
public class MessageController {
private final MessageRepository messageRepository;
@Autowired
public MessageController(Mes
作为一名
Linux SA,日常运维中很多地方都会用到脚本,而服务器的ip一般采用静态ip或者MAC绑定,当然后者比较操作起来相对繁琐,而前者我们可以设置主机名、ip信息、网关等配置。修改成特定的主机名在维护和管理方面也比较方便。如下脚本用途为:修改ip和主机名等相关信息,可以根据实际需求修改,举一反三!
#!/bin/sh
#auto Change ip netmask ga