Creating Blogs

The feature can be implemented by customising the generic functionality explained in Creating Articles

The Struts configuration to create a blog may look as follows:

<form-bean name="blogForm" type="com.ndc.usercontent.struts.actions.forms.ArticleForm" />

<action path="/blog/add"
        name="blogForm"
        scope="request"
        parameter="articleType=blog"
        type="com.ndc.usercontent.struts.actions.save.SaveArticle">
  <forward name="success" path="/create-blog-success.jsp" />
  <forward name="error" path="/create-blog.jsp" />
</action>

An example JSP that allows the user to fill up some form fields to create a blog can be as follows:

<community:user id="user"/>
<html:form styleId="addBlogForm" action="/blog/add">
  <html:hidden property="articleType" value="blog"/>
  <html:hidden property="homeSectionId" value="${user.section.id}"/>
  <html:hidden property="state" value="published"/>

  <html:text property="field(TITLE)" />
  <html:text property="field(BODY)" />

  <html:hidden property="errorUrl" value="error-url" />
  <html:submit value="Create"/>
</html:form>

The form and action classes used here are the same classes used to create general articles. For an explanation of the form fields, please have a look at: Creating Articles