Hi i make a solution to include a static html into a component
first i create a component type in /WEB-INF/classess/surf/site/components-type
Code:
<?xml version="1.0" encoding="UTF-8"?>
<component-type>
<id>include</id>
<title>Include Component Type</title>
<description>Includes static html into a compoent</description>
<processor mode="view">
<id>jsp</id>
<jsp-path>/WEB-INF/jsp/include.jsp</jsp-path>
</processor>
</component-type>
then i create the jsp for my component type
Code:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="org.springframework.extensions.surf.*" %>
<%@ page import="org.springframework.extensions.surf.types.*"%>
<%@ page import="org.springframework.extensions.surf.render.*" %>
<%
RenderContext context = (RenderContext) request.getAttribute("renderContext");
String componentId = (String) context.getValue(WebFrameworkConstants.RENDER_DATA_COMPONENT_ID);
Component component = context.getObjectService().getComponent(componentId);
String includeurl = component.getModelProperty("url");
%>
<jsp:include page="<%= includeurl%>"/>
this is a simple jsp:include, and i'm passing the url property with the location of the static content i want to show, i try to use a custom property but spring surf just parse the model properties, this could be a bug but i'm not sure
here is how i configure my page to use this component
Code:
<?xml version='1.0' encoding='UTF-8'?>
<page>
<id>pageid</id>
<title>Page title</title>
<template-instance>templateinstanceid</template-instance>
<authentication>none</authentication>
<components>
<component>
<region-id>include-region</region-id>
<component-type-id>include</component-type-id>
<url>/WEB-INF/staticcontent.html</url>
</component>
</components>
</page>
this solution solves my second question that is how to include static content in a component, i hope this can help
The first question is still pending :-(
how can i configure my spring-surf application in Alfresco WCM to be able to see the preview of a sandbox?, actually when i do this the virtual server fails, i think this a library problem
i also want to know if in future realeses of alfresco or spring surf, this will be supported out of the box
thanks