在Jsp中怎么导入Java类 | 您所在的位置:网站首页 › 在jsp中导入自定义标签的方式正确的是 › 在Jsp中怎么导入Java类 |
1.目录结构
2.在form.jsp中导入City类 为什么需要在form.jsp中导入City类? 如不导入City类,那么List cities=new ArrayList();则不能实例化。 Struts中的用法 City.java代码: package struts2; public class City { private Integer cityId; private String cityName; public Integer getCityId() { return cityId; } public void setCityId(Integer cityId) { this.cityId = cityId; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } //有参构造器 public City(Integer cityId, String cityName) { super(); this.cityId = cityId; this.cityName = cityName; } //无参构造器 public City() { } }form.jsp代码: Insert title here
|
CopyRight 2018-2019 实验室设备网 版权所有 |