[db:标题]

摘要:java 使用freemarker生成html 技术方案 java 1.8 + Freemarker maven依赖 <dependency> <group
java 使用freemarker生成html 技术方案 java 1.8 + Freemarker maven依赖 <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.31</version> <!-- 请使用最新版本 --> </dependency> 创建模板文件,保存至src/main/resources/templates/,文件名为template.html <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"></meta> <meta name="viewport" content="width=device-width, initial-scale=1.0"></meta> <title>${name}的简历</title> <style> @page { size: A4; margin: 5mm 10mm; /* 上下和左右两个方向的边距分别为 10mm 和 20mm */ } body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f4f4f9; } .container { width: 80%; margin: 0 auto; padding: 20px; background-color: #ffffff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } h1 { text-align: center; color: #333; } .section-title { color: #4CAF50; margin-top: 20px; } .section-content { margin: 10px 0; } .contact-info, .skills, .experience, .education { margin-bottom: 20px; } .experience, .education { margin-top: 10px; } ul { list-style-type: none; padding-left: 0; } li { margin-bottom: 10px; } .job, .degree { font-weight: bold; } </style> </head> <body> <div class="container"> <h1>${name}的简历</h1> <!-- 联系信息 --> <div class="contact-info"> <h2 class="section-title">联系信息</h2> <p>邮箱: ${email}</p> <p>电话: ${phone}</p> <
阅读全文