在Jsp中怎么导入Java类 您所在的位置:网站首页 在jsp中导入自定义标签的方式正确的是 在Jsp中怎么导入Java类

在Jsp中怎么导入Java类

2023-12-12 02:58| 来源: 网络整理| 查看: 265

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 实验室设备网 版权所有