Skip to content

Instantly share code, notes, and snippets.

@mariodavid
Last active February 15, 2020 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariodavid/e68fa2dd2bcd497cd0febc1076bfee72 to your computer and use it in GitHub Desktop.
Save mariodavid/e68fa2dd2bcd497cd0febc1076bfee72 to your computer and use it in GitHub Desktop.
CUBA platform portal: activate JSP support
<%
/* this file is located at %CUBA_APP_ROOT%/portal/web/WEB-INF/pages/index.jsp */
%>
<html>
<head><title>First JSP</title></head>
<body>
<%
double num = Math.random();
if (num > 0.95) {
%>
<h2>You'll have a luck day!</h2><p>(<%= num %>)</p>
<%
} else {
%>
<h2>Well, life goes on ... </h2><p>(<%= num %>)</p>
<%
}
%>
<a href="<%= request.getRequestURI() %>"><h3>Try Again</h3></a>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd">
<mvc:annotation-driven/>
<mvc:view-controller path="/error/404"/>
<mvc:view-controller path="/error/500"/>
<mvc:view-controller path="/maintain"/>
<context:component-scan base-package="uk.co.wealthclub.clover.portal.controllers"/>
<context:component-scan base-package="com.haulmont.cuba.restapi"/>
<!-- Static resources -->
<!--suppress SpringModelInspection -->
<mvc:resources mapping="/resources/**" location="/resources/" cache-period="0"/>
<!-- Default exception handlers from CUBA -->
<bean class="com.haulmont.cuba.portal.sys.exceptions.PortalExceptionResolver">
<property name="noUserSessionUrl" value="/login"/>
<property name="noMiddlewareConnectionUrl" value="/maintain"/>
</bean>
<!-- change the view resolver to look for jsp files in /WEB-INF/pages/ -->
<!-- see http://www.mkyong.com/spring-mvc/spring-mvc-internalresourceviewresolver-example/ for more information -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="prefix">
<value>/WEB-INF/pages/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
</beans>
@desaurabh
Copy link

Hi, Do you think this will still work with platform version 7.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment