[opencms-dev] Visibility of the OpenCMS Object inside Struts Action

Stephan Hartmann hartmann at metamesh.de
Tue May 3 17:41:54 CEST 2005


You can create your own CmsObject with

org.opencms.main.OpenCms#initCmsObject("Guest");

But you have to make sure that your OpenCms servlet has been started before.

Regards,
Stephan


-- 
Stephan Hartmann

metamesh

Lippstädter Str. 22
44143 Dortmund

http://www.metamesh.de/

Maximiliano Basili schrieb:
> Hi all...
> 
> I want to work with struts inisde opencms.
> I have a Struts Action that has to create a resource so I need the
> OpenCMS object,
>  
> I want to know how can I access the opencms object inside that struts action,
> I put some code that I test:
> 
> 	protected CmsObject getCmsObject(HttpServletRequest req)
> 			throws ServletException {		
> 		CmsFlexController controller = (CmsFlexController) req
> 				.getAttribute(CmsFlexController.ATTRIBUTE_NAME);
> 
> 		if (controller == null) {
> 			throw new ServletException(
> 					"OpenCmsStrutsAction could not obtain CmsObject! ATT_NAME ==> " +
> CmsFlexController.ATTRIBUTE_NAME);
> 		} else
> 			return controller.getCmsObject();
> 	}
> 
> 
> The controller is null I think because for this point I can't reach
> the OpenCMS Servlet so I can't access to the VFS....
> 
> Any suggestions will be appreciated...
> 
> Thanks in advance!!
> 
> Matute (Matías Basilico)
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hartmann.vcf
Type: text/x-vcard
Size: 350 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050503/7ff8b252/attachment.vcf>


More information about the opencms-dev mailing list