Book Image

Building Websites with OpenCms

Book Image

Building Websites with OpenCms

Overview of this book

This book takes you through the process of creating content-rich websites and applications using OpenCms. Although powerful and flexible, OpenCms can be daunting on first approach, but its advanced features reward the investment in learning. This book exists to ease Java developers into getting the most from OpenCms. OpenCms OpenCms is a professional-level, open source Website Content Management System, with which you can create and manage complex websites. Based on Java and XML technology, it fits into almost any modern IT environment. With hard-won experience of the practical difficulties faced by developers working with OpenCms, this book is the embodiment of the author's expertise, and the perfect way to master the system.
Table of Contents (12 chapters)
Building Websites with OpenCms
Credits
About the Author
Introduction

Creating an Administration JSP


We now have a folder for our administration point. Inside that folder, we create a new JSP named index.html (note that the extension should be .html, not .jsp).

We want to create a page that will allow us to specify a stylesheet, a source directory, and a destination directory (just like the scheduled task in the last chapter) and then run the XSLT transformation on the fly.

The JSP Code

Instead of splitting the application into multiple pages, we can handle the whole transformation with one JSP file that includes both the form and the code for processing the form values. Aside from being more efficient to code, it also presents a simple user interface.

Here is the beginning of the code for the index.html JSP:

<%@ page session="false" 
    import="com.opencms.flex.jsp.CmsJspActionElement,
            com.opencms.file.CmsObject,
            com.opencms.core.CmsException,
            com.example.genericxml.xslt.BatchTransformer" 
%>
<%
  String xslt ...