> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/thymeleaf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/thymeleaf/i.-using-thymeleaf/17-jie-ou-de-mo-ban-luo-ji/17.5-resolution-of-decoupled-logic.md).

# 17.5 解耦的逻辑的解析

Thymeleaf解析解耦的逻辑资源的方式由用户配置。 它取决于扩展点——`org.thymeleaf.templateparser.markup.decoupled.IDecoupledTemplateLogicResolver`。还有一个默认的实现：`StandardDecoupledTemplateLogicResolver`。

这个标准的实现做了什么呢？

* 首先，它对模板资源的基本名称应用`前缀`和`后缀`（通过`ITemplateResource#getBaseName()`方法）。前缀和后缀都可以配置。默认的，前缀将会为空，而后缀会是`.th.xml`。
* 其次，它通过`ITemplateResource#relative(String relativeLocation)`方法，用计算出的名称，请求模版资源解析相对的资源。

`IDecoupledTemplateLogicResolver`的特定实现可以很容易地在`TemplateEngine`里配置：

```java
final StandardDecoupledTemplateLogicResolver decoupledresolver = 
        new StandardDecoupledTemplateLogicResolver();
decoupledResolver.setPrefix("../viewlogic/");
...
templateEngine.setDecoupledTemplateLogicResolver(decoupledResolver);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jack80342.gitbook.io/thymeleaf/i.-using-thymeleaf/17-jie-ou-de-mo-ban-luo-ji/17.5-resolution-of-decoupled-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
