条件:是多模块项目
第一步:将需要依赖的模块选中(如:SchoolWabUI)
第二步:添加模块依赖
第三步:指定需要依赖的模块
依赖成功
第四步:指定输出
依赖完成
简单测试
第一步:在Entities模块添加一个类
package com.wbg.student; public class studentInfo { String name="张三"; int age=15; @Override public String toString() { return "studentInfo{" + "name=‘" + name + ‘\‘‘ + ", age=" + age + ", sex=‘" + sex + ‘\‘‘ + ‘}‘; } String sex="男"; public studentInfo() { } public String getName() { return name; } public studentInfo(String name, int age, String sex) { this.name = name; this.age = age; this.sex = sex; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } }
第二步:在WebUI进行引用
<%@ page import="com.wbg.student.studentInfo" %><%-- Created by IntelliJ IDEA. User: 小邦哥 Date: 2018/9/23 Time: 14:50 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> <%=new studentInfo().toString()%> </body> </html>
第三步:添加tomact
.
两个之间的区别:https://www.cnblogs.com/weibanggang/p/9692754.html
测试成功
原文地址:https://www.cnblogs.com/weibanggang/p/9692747.html
时间: 2024-10-11 14:46:19