[opencms-dev] Struts integration as module

Erik-Jan Spaans E.J.Spaans at inter.NL.net
Tue Mar 8 23:47:07 CET 2005


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
>




More information about the opencms-dev mailing list