关于引入 jsp

我参考这个之后还是无法访问(404):https://www.cuba-platform.com/discuss/t/jsp-template-instead-of-html-or-thymeleaf-template/3546

web-dispatcher-spring.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context">

  <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    <property name="prefix" value="/WEB-INF/templates/"/>
    <property name="suffix" value=".jsp"/>
    <property name="order" value="3"/>
  </bean>
</beans>

com.company.example.controller.PortalController.java:

@Controller
public class PortalController {
    @GetMapping("portal")
    public String portal() {
        return "portal";
    }
}

*/modules/web/web/WEB-INF/templates/index.jsp:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Home</title>
</head>
<body>
I'm Home.
</body>
</html>

似乎找到问题了,我试试new个portal module试试

已解决:Module中新建portal,添加相关配置到 portal-dispatcher-spring.xml 即可

ref: https://doc.cuba-platform.com/manual-6.10/portal.html?_ga=2.16938672.845956612.1571018783-190245983.1569484592

1 个赞