[opencms-dev] flex: JSP and templates?

Alexander Kandzior alex at opencms.org
Fri Aug 30 13:19:00 CEST 2002


Stefan,

> What we would need currently is to use a "standard" template 
> for our JSP content pages - is that possible in version 5 
> beta, too? Like if you make a new JSP page in some content 
> folder, assign a template to it  (just like to a standard 
> HTML file)...?

Try it like this:

------------------------
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"  %>

<cms:include page="demodefault_head.jsp" />

Some HTML stuff.

<cms:include page="demodefault_foot.jsp" />
------------------------

Note: You can not use the WYSIWYG Editor on this pages. 
Use the XML approach show below for that.
Oviously, the head / foot JSP files can be shared between XML and JSP.

In case want you "assign" the target of the include with 
a property, this is unsupported in the 5.0 beta 1.
Maybe it will make the final. 

Regards,
 
Alex.
 
Alexander Kandzior
OpenCms Group / Alkacon Software


> Hi Stefan,
> 
> > another problem we are currently encountering is this:
> > it doesn't seem to be possible to use templates for JSP pages... is 
> > that correct?
> 
> This is true in the Flex alpha 1 release, but not longer in 
> the 5.0 beta 1 release. We are currently preparing a (rather 
> extensive) demo which will show how you build a Template with JSP.
> 
> Here's a code snippet for a template from the upcoming demo. 
> You probably get the idea. Place this in the 
> "/content/templates" directory.
> 
> -------------------
> <?xml version="1.0" encoding="utf-8"?>
> <xmltemplate>
>     <!-- This describes the template -->
>     <template>
>         <element name="head"/>
>         <element name="body"/>
>         <element name="foot"/>
>     </template>
> 
>     <!-- Include A JSP as "head" element: -->
>     <elementdef name="head">
>         <!-- This class is the same for all JSP -->
>         <class>com.opencms.flex.CmsJspTemplate</class>
>         <!-- Here goes the JSP file to include -->
>         <template>demodefault_head.jsp</template>
>     </elementdef>
> 
>     <!-- Include A JSP as "foot" element: -->
>     <elementdef name="foot">
>         <!-- This class is the same for all JSP -->
>         <class>com.opencms.flex.CmsJspTemplate</class>
>         <!-- Here goes the JSP file to include -->
>         <template>demodefault_foot.jsp</template>
>     </elementdef>
> </xmltemplate>
> ---------------------
> 
> Important: In case you use JSP - Templates, you currently 
> must set the "export" property to "false" for the pages since 
> JSP can currently not be exported. It's ok to set this 
> proprty on a folder to prevent all files in this folder from 
> being exported.
> 
> 
> Best Regards,
> 
> Alex.
> 
> Alexander Kandzior
> OpenCms Group / Alkacon Software
> 
> 
> 
> 
> 
> 
> 





More information about the opencms-dev mailing list