[opencms-dev] Struts integration as module
Sverker Abrahamsson
sverker at abrahamsson.com
Wed Mar 9 01:07:05 CET 2005
Ok, I think I've found one answer for my questions below. The settings are
done in manifest.xml. Are there any schema or dtd on what settings can be
made there?
/Sverker
----- Original Message -----
From: "Sverker Abrahamsson" <sverker at abrahamsson.com>
To: "The OpenCms mailing list" <opencms-dev at opencms.org>
Sent: Wednesday, March 09, 2005 12:38 AM
Subject: Re: [opencms-dev] Struts integration as module
> Hi EJ,
> I don't want to create Form and Action classes from the workplace but I
> almost always use dynamic forms. You are right though that since the
> action implementation depends on the form used it might not be so
> interesting to create them from the workplace.
>
> However, action mappings is a different story. I have a number of general
> actions that e.g. fetch a bunch of data that are to be displayed on
> different pages. Depending on the category of data I want the
> presentation to be different. Today, when I don't use OpenCms I have a
> number of action mappings to the same Action, with different forwards.
>
> The people who are to create the action mappings are my co-developers so
> they know Struts, however what we want to avoid is to have to redeploy the
> whole app as long as we haven't changed any java code.
>
> My question is not so much regarding Struts in this case, I think I have
> figured out how I want to integrate it, but about how I add a file type in
> a module. If I would do it directly to the core, I add a explorertype
> element to opencms-workplace.xml and a resourceloader and resourcetype to
> opencms-vfs.xml, implement the corresponding classes
> (CmsStrutsActionLoader, CmsResourceTypeStrutsAction) and a jsp,
> newresource_struts.jsp to be used when creating a new action mapping.
>
> Using a resource loader means that the request would pass through the
> OpenCms servlet and go through the normal path with checking for access
> rights etc before being handed over to a Struts RequestDispatcher. It
> should at the same time be possible to add a StrutsActionServlet mapping
> to web.xml and invoke struts the usual way. With the Struts module
> mechanism it's quite easy to connet them together.
>
> But your mail show that this should be put in a module, not in the core,
> as there are a few different ways to do it and peoples preferences are
> different.
> /Sverker
>
> ----- Original Message -----
> From: "Erik-Jan Spaans" <E.J.Spaans at inter.NL.net>
> To: "The OpenCms mailing list" <opencms-dev at opencms.org>
> Sent: Tuesday, March 08, 2005 11:47 PM
> Subject: Re: [opencms-dev] Struts integration as module
>
>
>> Hi Sverker,
>>
>> I basically took the following approach:
>> 1. create a module called <companyname>.opencms.struts containing the
>> Struts.jar and struts-config.xml and other config files (validation) etc.
>> 2. for each Struts application, create an additional module called
>> <companyname>.opencms.struts.<appname> containing the applications jar
>> file with Actions and ActionForms and the <modulename>-config.xml (using
>> the Struts module functionality).
>> 3. All additional struts based modules are dependent on the base Struts
>> module.
>> 4. Make sure the struts-config files are written to the right location.
>>
>> This approach has a disadvantage: web.xml has to be edited to add each
>> Struts module as init-parameter. But maybe an extended version of the
>> Struts base module can be created that uses JMX or some other tool to
>> edit the web.xml file.
>>
>> Personally I don't see many advantages in letting users of the system
>> create mappings, forms and forwards. The user cannot create a Struts form
>> without extensive knowledge of the internals of the backing form bean
>> (mapping of form elements to bean properties etc.), and probably also of
>> the Struts Action.
>>
>> I do see advantages of users including the forms and views from an
>> installed module in their pages. Of course, then the correct flow
>> according to the action mappings has to be safeguarded. By this I mean:
>> when you specify in your action mapping that the "success" forward of
>> Action A must forward to "/opencms/somepath/somefile", the user must
>> include your Struts form or view in that location. Still have to figure
>> out how to do this!
>>
>> Best regards,
>> EJ
>>
>> Sverker Abrahamsson wrote:
>>
>>> I am currently looking into integrating support for Struts into OpenCMS
>>> with the following requirements:
>>>
>>> * A struts action mapping should be created like any other new
>>> resource in the Explorer view. All parameters, as well as
>>> forwards should be set from the dialog.
>>> * Forms, global forwards etc should be edited from the
>>> Administration view.
>>> * Management of the Action classes themselves are not part of the
>>> scope, they are either installed as jar files in WEB-INF/lib or
>>> loaded as module.
>>> * Compatibility with the traditional way of configuring struts in
>>> web.xml and struts-config.xml.
>>>
>>> I have more or less figured out how to integrate with Struts, with a
>>> loader and file type class in OpenCMS. However, today I read a posting
>>> on the mailing list (OpenCMS 6.0 : Is it possible to add a
>>> new(xml-)contenttype only by importing a module) with the answer that
>>> yes, it is possible and that templateone is a such example.
>>> Now my question is, would it be possible to do the same for Struts? I
>>> think it would be better to package it as a module than to integrate it
>>> to the core. However, when I look at templateone demo, I can't figure it
>>> out. What should I look for?
>>> Best regards
>>> Sverker
>>>
>>>------------------------------------------------------------------------
>>>
>>>
>>>
>>>_______________________________________________
>>>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
>>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>
>
>
> _______________________________________________
> 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
>
More information about the opencms-dev
mailing list