> >> In general, this "app created from subapps" is something that needs
> >> to be considered in all aspects. WebWork was monolithic in this
> >> sense, and it'd be good if we can move away from that. As I've
> >> already noted a couple of times, I think in the future it will be
> >> more common to build webapps from smaller webapps, e.g. through
> >> portlets.
> >
> >
> > I agree. How would the sub-apps configuration get loaded? How are
> > they packaged?
> 
> That's a good question. Are there any other frameworks we can look at
> for inspiration here?

The struts model for doing this is to:

1. create a separate struts-config.xml file for each subapp.  For
example, struts-config.xml, struts-config-admin.xml,
struts-config-user.xml. 

2. register each subapp via web.xml

        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>config/admin</param-name>
            <param-value>/WEB-INF/struts-config-admin.xml</param-value>
        </init-param>
        <init-param>
            <param-name>config/voice</param-name>
            <param-value>/WEB-INF/struts-config-voice.xml</param-value>
        </init-param>

The main challenge I saw to this model was having a shared JSP space.
The sub-application developers need to coordinate with one another to
ensure that there aren't any conflicts in JSP path selection.  For
example, if one project wants to place its views in /WEB-INF/jsp/, then
none of the other subprojects should place their views there.  The same
is true of resources such as images and js files, etc.

Using velocity views was a lot cleaner as you could just dump a jar file
into the /WEB-INF/lib/ directory and be done with it.  However, velocity
is a second class citizen in the struts world.


Here's a suggested solution:

* Each application should have its own xwork.xml file that is placed at
the root level of the project.  For example,
com/indigoegg/myproject/xwork.xml for a project with a root of
com.indigoegg.myproject

* Allow xwork.xml to include other xml files via the follow (or similar)
construct:

<package namespace="subapp">
  <subapp name="com.indigoegg.myproject"/>
</package>

* These included configuration files should be able to to, in turn call
other configuration files to allow creation of applications by
composition.
 
* The subapp need only be aware of its defined namespace.  For example,
if an Action from the subapp calls

        ActionInvocation invocation = new ActionInvocation("/", "login")
;

They should get a reference to /subapp/login essentially.  

* In addition to the <subapp> tag, there should also be an <include>
tag, peered with <package>, to allow developers to break up large
xwork.xml files.

--
Matt Ho
Principal
Indigo Egg, Inc.
http://www.indigoegg.com/






-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to