javaEEday05-请求响应-响应-案例3

This commit is contained in:
2026-05-17 14:05:19 +08:00
parent c80ed24cdf
commit 21cf34d164
2 changed files with 6 additions and 5 deletions

View File

@@ -15,7 +15,8 @@ public class EmpController {
@RequestMapping("/listEmp")
public Result listEmp(){
//1.加载并解析emp.xml
String file = "D:\\workspace_idea\\inmind_web_project260428\\springboot-web-req-resp\\src\\main\\resources\\emp.xml";
//String file = "D:\\workspace_idea\\inmind_web_project260428\\springboot-web-req-resp\\src\\main\\resources\\emp.xml";
String file = this.getClass().getClassLoader().getResource("emp.xml").getFile();
List<Emp> emps = XmlParserUtils.parse(file, Emp.class);
//2.对数据进行处理
emps.stream().forEach((emp->{

View File

@@ -3,7 +3,7 @@
<emp>
<name>金毛狮王</name>
<age>55</age>
<image>https://web-framework.oss-cn-hangzhou.aliyuncs.com/web/1.jpg</image>
<image>https://inmind-test1.oss-cn-hangzhou.aliyuncs.com/01567124-ddf7-401f-9956-96ba62b0a8ea.jpg</image>
<!-- 1: 男, 2: 女 -->
<gender>1</gender>
<!-- 1: 讲师, 2: 班主任 , 3: 就业指导 -->
@@ -13,7 +13,7 @@
<emp>
<name>白眉鹰王</name>
<age>65</age>
<image>https://web-framework.oss-cn-hangzhou.aliyuncs.com/web/2.jpg</image>
<image>https://inmind-test1.oss-cn-hangzhou.aliyuncs.com/01567124-ddf7-401f-9956-96ba62b0a8ea.jpg</image>
<gender>1</gender>
<job>1</job>
</emp>
@@ -21,7 +21,7 @@
<emp>
<name>青翼蝠王</name>
<age>45</age>
<image>https://web-framework.oss-cn-hangzhou.aliyuncs.com/web/3.jpg</image>
<image>https://inmind-test1.oss-cn-hangzhou.aliyuncs.com/01567124-ddf7-401f-9956-96ba62b0a8ea.jpg</image>
<gender>1</gender>
<job>2</job>
</emp>
@@ -29,7 +29,7 @@
<emp>
<name>紫衫龙王</name>
<age>38</age>
<image>https://web-framework.oss-cn-hangzhou.aliyuncs.com/web/4.jpg</image>
<image>https://inmind-test1.oss-cn-hangzhou.aliyuncs.com/01567124-ddf7-401f-9956-96ba62b0a8ea.jpg</image>
<gender>2</gender>
<job>3</job>
</emp>