[opencms-dev] How to use CmsObject.writePropertyObject

Christian Steinert christian_steinert at web.de
Fri Jun 9 17:20:36 CEST 2006


Xuan Wang schrieb:
> 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".

Hi

maybe you have to lock the resource, before writing?
    cmsObject.lockResource(<filename>,CmsLock.COMMON);

hth

christian



More information about the opencms-dev mailing list