我想将 Broadleaf thymeleaf ui 更改为 AngularJS。
已编辑
<!-- Commented bean -->
<!-- <bean class="org.broadleafcommerce.common.web.BroadleafThymeleafViewResolver">
<property name="templateEngine" ref="blWebTemplateEngine" />
<property name="order" value="1" />
<property name="cache" value="${thymeleaf.view.resolver.cache}" />
<property name="characterEncoding" value="UTF-8" />
</bean> -->
Added new viewresolver
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/templates/</value>
</property>
<property name="order" value="1" />
</bean>
排除百里香 jar 并添加所有 bean 类 根据http://www.broadleafcommerce.com/docs/core/current/appendix/removing-thymeleaf
加载页面时出错
在名为“mycompany”的 DispatcherServlet 中未找到带有 URI [/WEB-INF/templates/index.html] 的 HTTP 请求的映射
最佳答案
为什么要完全删除 Thymeleaf?你想做同构吗?如果没有,您所要做的仍然是渲染 Thymeleaf 模板,但使用它只在页面上包含 AngularJS 库,而不是在 Thymeleaf 中执行任何其他操作。然后,您只需在前端编写所有内容,就像使用普通的 Angular 应用程序一样。
此外,如果您使用的是 Broadleaf Controller (演示应用程序中提供的 Controller ),那么如果您想完全更改模板结构,则需要更改几乎所有 Controller (或者直接扔掉它们)。在这种情况下, Controller 返回“index”,但现在 Spring 不知道如何解释“/WEB-INF/templates/index.html”,因为您删除了 View 解析器。
关于java - 如何将阔叶百里香切换到 angularjs ui,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35315655/