[opencms-dev] How to use CmsObject.writePropertyObject

王轩 xwang.java at gmail.com
Thu Jun 8 09:57:20 CEST 2006


hi everyone :
    I  use CmsObject.writePropertyObject to modify the property of my
Xmlpage file. I create CmsProperty use this code

        CmsProperty prop = new CmsProperty();
        prop.setAutoCreatePropertyDefinition(true);
        // set property name
        prop.setName(name);
        // set property value
        if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
            prop.setValue(value, CmsProperty.TYPE_INDIVIDUAL);
        } else {
            prop.setValue(value, CmsProperty.TYPE_SHARED);
        }

  Then I use writePropertyObject(java.lang.String
resourcename,CmsProperty property) function to modify page property.
  I write  title property of page ,can't succeed.
  the error are
javax.servlet.ServletException: Error writing property "Keywords" on
resource "/news/20060606/4.html".
	at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
	at org.apache.jsp.WEB_002dINF.jsp.offline.sites.default_.publish.test.showproperty_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.offline.sites.default_.publish.test.showproperty_jsp:132)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
	at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194)
	at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:170)
	at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:433)
	at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423)
	at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:174)
	at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:467)
	at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:412)
	at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:719)
	at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1362)
	at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:151)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

please give me some suggest .
thank a lot

Regards
wang xuan



More information about the opencms-dev mailing list