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

Maximiliano Basili matute.listas at gmail.com
Tue May 3 16:12:47 CEST 2005


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)


-- 
Tutek.



More information about the opencms-dev mailing list