[opencms-dev] Create a txt file with fixed header/footer
Paoletti Corrado
c.paoletti at fineco.it
Tue Nov 18 13:53:36 CET 2014
Hi Kai,
I'm following your suggestion.
1) I have created a XSD (simple-text.xsd) starting by page you suggested:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:element name="XmlContentDocSimpleTypes" type="OpenCmsXmlContentDocSimpleTypes"/>
<xsd:complexType name="OpenCmsXmlContentDocSimpleTypes">
<xsd:sequence>
<xsd:element name="XmlContentDocSimpleType" type="OpenCmsXmlContentDocSimpleType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsXmlContentDocSimpleType">
<xsd:sequence>
<xsd:element name="SimpleText" type=" TextareaWidget" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
</xsd:complexType>
</xsd:schema>
2) I have created a JSP (simple-text.jsp):
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<div class="element">
<cms:contentload collector="singleFile" param="%(opencms.uri)" editable="true">
<p>
<cms:contentshow element="SimpleText" />
</p>
</cms:contentload>
</div>
3) then I have created a html file with xmlcontent type and template-elements = "simple-text.jsp ". When I try to edit it I have "An unexpected error happened, but no error message has been provided. " and error log is:
java.lang.NullPointerException
at org.opencms.xml.content.CmsXmlContent.getContentDefinition(CmsXmlContent.java:786)
at org.opencms.xml.content.CmsXmlContent.<init>(CmsXmlContent.java:132)
at org.opencms.xml.content.CmsXmlContentFactory.unmarshal(CmsXmlContentFactory.java:224)
at org.opencms.xml.content.CmsXmlContentFactory.unmarshal(CmsXmlContentFactory.java:160)
at org.opencms.workplace.editors.CmsXmlContentEditor.initWorkplaceRequestValues(CmsXmlContentEditor.java:1524)
at org.opencms.workplace.CmsWorkplace.initWorkplaceMembers(CmsWorkplace.java:1946)
at org.opencms.workplace.CmsWorkplace.<init>(CmsWorkplace.java:250)
at org.opencms.workplace.tools.CmsToolDialog.<init>(CmsToolDialog.java:93)
at org.opencms.workplace.CmsDialog.<init>(CmsDialog.java:260)
at org.opencms.workplace.editors.CmsEditorBase.<init>(CmsEditorBase.java:51)
at org.opencms.workplace.editors.CmsEditor.<init>(CmsEditor.java:201)
at org.opencms.workplace.editors.CmsXmlContentEditor.<init>(CmsXmlContentEditor.java:230)
at org.apache.jsp.WEB_002dINF.jsp.offline.system.workplace.editors.xmlcontent.editor_005fform_jsp._jspService(editor_005fform_jsp.java:59)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:188)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:163)
at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:619)
at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:417)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:167)
at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:893)
at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:524)
at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:1049)
at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1596)
at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
Where am I doing wrong?
Many thanks,
Corrado
-----Original Message-----
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Schliemann, Kai
Sent: venerdì 14 novembre 2014 13:35
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Create a txt file with fixed header/footer
Hi Corrado,
you could create a XML Content type with just one element. This element uses the TextareaWidget type (more info: https://opencms.cse.unsw.edu.au/alkacon-documentation/documentation_xmlcontent/step3-advancedxsd.html).
HTH
Best regards
Kai
-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Paoletti Corrado
Gesendet: Freitag, 14. November 2014 12:06
An: opencms-dev at opencms.org
Betreff: [opencms-dev] Create a txt file with fixed header/footer
Hi all,
I would like to create a template with which to allow editors to create a simple text file (.txt). Each file will have a header and footer and variabile body.
I have created the following simple code (JSP):
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
***HEADER***
<cms:include element="body" />
***FOOTER***
When I create a "Page with free text" the editor inserts <p></p> tags around text I'm writing but... I do not want html tags! The best would be have an editor very simple as if I choose to create a "text file".
How can I do it?
I use OpenCms 8.0.1.
Thanks
Corrado
_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list