Book Image

OpenCms 7 Development

By : Dan Liliedahl
Book Image

OpenCms 7 Development

By: Dan Liliedahl

Overview of this book

<p>OpenCms is a professional-level open-source Website Content Management System, based on Java and XML. Many companies or organizations have requirements that go beyond what is available in the standard OpenCms application. Thankfully, OpenCms can be used by Java developers to create sophisticated add-ons and customizations that extend the power of OpenCms in virtually unlimited directions.<br /><br />Targeting version 7 of OpenCms, this book is for Java developers interested in extending and further customizing OpenCms through its Java API.<br /><br />Starting by showing how to set up a development environment for OpenCms work, the book moves you through various tasks of increasing complexity. Some of the common tasks covered are building OpenCms, XML asset type development, templating, module development, user and role setup, and search integration. In addition to these common tasks some more advanced topics are covered such as self-registering users, RSS support, developing custom widgets and extending the administrative interface. All the topics include examples and are presented while building a sample blog site. <br /><br />The skills you develop will make you an OpenCms developer to be reckoned with!</p>
Table of Contents (16 chapters)
OpenCms 7 Development
Credits
About the Author
About the Reviewer
Preface
Index

User Login and Registration Code


Our site requires users to register before they can add comments. This will be supported via an 'Add a Comment' link at the end of each blog. Logged-in users will be able to add their comments immediately. All others will be taken to a registration signup page. Registered users may be able to log on at any time through a login button available at the top of the screen.

To enable this feature, we need to add a new JSP for the user registration page. The JSP will reside in the elements folder of our module and will be named Register.jsp. The JSP page looks similar to our other JSP templates. At the top, we include the imports and tag libraries, and then declare and instantiate the bean class:

<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms"%>
<%@ page import="com.deepthoughts.templates.*" %>
<%
    // create the bean
    BlogJspTemplate blog = new BlogJspTemplate(pageContext, request, response);
%>

The rest of the JSP is like...