当前位置:网站首页>Use of freemaker
Use of freemaker
2022-07-02 14:16:00 【Love sinus】
rely on
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
Template content
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:gw=\"urn:gwService\">
<SOAP-ENV:Body SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<gw:ldtpExchStatusQuery>
<transId>${transId}</transId>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Specific use
// Set up the data
Map dataMap = new HashMap<>();
dataMap.put("transId","abc");
// Set version number
Version version = new Version("2.3.28");
Configuration configuration = new Configuration(version);
configuration.setDefaultEncoding("utf-8");
// Template file path
configuration.setDirectoryForTemplateLoading(new File("D:\freemarker.xml"));
Template template = configuration.getTemplate("freemarker.xml");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Writer w = new OutputStreamWriter(out, "utf-8");
// Write data to the template
template.process(dataMap, w);
w.close();
byte[] bytes = out.toByteArray();
out.close();
MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), bytes);// Get the final template
边栏推荐
- php链表创建和遍历
- Teamtalk source code analysis win client
- 每日学习2
- Pycharm连接远程服务器
- 混沌工程平台 ChaosBlade-Box 新版重磅发布
- Téléchargement par navigateur
- Use of UIC in QT
- The evolution process of the correct implementation principle of redis distributed lock and the summary of redison's actual combat
- In 2021, the global revenue of structural bolts was about $796.4 million, and it is expected to reach $1097.6 million in 2028
- go操作redis
猜你喜欢
The most complete analysis of Flink frame window function
Téléchargement par navigateur
uniapp小程序 subPackages分包配置
当贝投影4K激光投影X3 Pro获得一致好评:万元投影仪首选
Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?
The global special paper revenue in 2021 was about $27 million, and it is expected to reach $35 million in 2028. From 2022 to 2028, the CAGR was 3.8%
瀏覽器驅動的下載
【虹科技术分享】如何测试 DNS 服务器:DNS 性能和响应时间测试
PyQt5_ Qscrollarea content is saved as a picture
大家信夫一站式信用平台让信用场景“用起来
随机推荐
Golang quickly generates model and queryset of database tables
线性dp求解 最长子序列 —— 小题三则
联合搜索:搜索中的所有需求
Mysql5.7 installation super easy tutorial
Qt原代码基本知识
Data Lake (11): Iceberg table data organization and query
Route (II)
The most complete analysis of Flink frame window function
Solving the longest subsequence with linear DP -- three questions
The global special paper revenue in 2021 was about $27 million, and it is expected to reach $35 million in 2028. From 2022 to 2028, the CAGR was 3.8%
千元投影小明Q1 Pro和极米NEW Play谁更好?和哈趣K1比哪款配置更高?
D language, possible 'string plug-ins'
[usaco05jan]watchcow s (Euler loop)
Do you know that there is an upper limit on the size of Oracle data files?
kaggle如何使用utility script
刚好1000粉丝,记录一下
2022 home projector preferred! Dangbei F5 brings the ultimate audio-visual experience with its powerful audio-visual effect
Systemserver process
BeanUtils -- shallow copy -- example / principle
Story points vs. human days