struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richards, Devin N (Devin)" <de...@lucent.com>
Subject RE: multiple sub projects
Date Fri, 06 Sep 2002 20:00:11 GMT
We have deployed our first struts project that was composed of three disjoint applications.
After reading this thread I am attempting to make them each a sub-project in struts.

Question 1: We currently use one AppliactionResources.properties file for all three projects
due to the way the validator works (it does not take the bundle argument.) Is there a way
for the sub-projects to pull in (i.e. merge) their local AppliactionResources.properties with
a "global" one? Or should we postpone the use of the validator, manually code the rules in
the validate() method not the validation.xml and use multiple <message-resource> definitions?

Question 2: As all of our pages share a common look and feel they are all based on a standard
tiles definition. Is it possible to create some "global" tiles definitions that each of these
sub-projects can extend, or do we need to reproduce the entire tiles-def.xml for each sub-project?

TIA for your help/advice

-Devin


-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Friday, August 16, 2002 4:29 PM
To: Struts Users Mailing List
Subject: Re: multiple sub projects




On Fri, 16 Aug 2002, Michael Delamere wrote:

> Date: Fri, 16 Aug 2002 21:38:49 +0200
> From: Michael Delamere <home@michael-delamere.de>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> Subject: multiple sub projects
>
> Hi,
>
> I´ve just read some chapters from the oreilly struts book in order to find
> out more about creating multiple sub-projects.  Very nice book!
>
> Ok, I know how to define another struts-config xml.  But in the case of the
> order example how do I tell struts to use the struts-order-config.xml?
>
> order.do -> use struts-order-config.xml
>
> Could someone provide me with an example please or send me a link where I
> can find out more.
>

The key is in the module prefixes.

Let's say your webapp is installed under context path "/myapp" and you
have the following configuration settingss in your web.xml file:

    <servlet>
      <servlet-name>controller</servlet-name>
      <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
      ...
      <init-param>
        <param-name>config/foo</param-name>
        <param-value>/WEB-INF/struts-config-foo.xml</param-value>
      </init-param>
      <init-param>
        <param-name>config/bar</param-name>
        <param-value>/WEB-INF/struts-config-bar.xml</param-value>
      </init-param>
    </servlet>

    <servlet-mapping>
      <servlet-name>controller</servlet-name>
      <url-pattern>*.do</url-pattern>
    </servlet-mapping>

Now, a path like "/myapp/foo/order.do" will go to the "/foo" module, while
paths like "/myapp/bar/order.do" will go to the "/bar" module.  You do the
same things with your JSP pages -- put them in "/foo" and "/bar"
subdirectories under the context root.

Note that *inside* the struts-config.xml file for a module, you do not
include the module prefix in any of the paths.  In other words, in each
module you'd still have an <action path="/order" ...> element.  Struts
will tack the module prefix onto the front where necessary, just like it
adds the context path for your webapp automatically.

> Any help would be appreciated,
>
> thanks,
>
> Michael
>

Craig


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message