aspose file tools*
The moose likes Struts and the fly likes using tiles & validator across modules Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "using tiles & validator across modules" Watch "using tiles & validator across modules" New topic
Author

using tiles & validator across modules

Jason Berk
Ranch Hand

Joined: May 03, 2006
Posts: 41
how can I configure my struts-config files to allow modules to define the validation rules and tiles definitions they (and only they) need, while defining cross application validations/tile-defs at the default struts config level?

Currently, we do NOT use the default struts config. It is defined and loaded by web.xml, but is empty (only stub comments generated by the IDE). I've got validation and tiles working (finally), but everything is defined in my modules config file. I'd like to abstract out those rules/defs that can/will be used in any future development or else each modules config file will have to specify every other modules rules/defs, and that won't scale well.

I would like to have the following dir structure:

/WEB-INF/struts
............/common
................/validations
..................../myCompany-validator-rules.xml
..................../validator-rules.xml
................/definitions
..................../DefaultDefs.xml
................/layouts
..................../DefaultLayout.jsp
................/tiles
..................../header.jsp
..................../footer.jsp
............/modules
................/FooApp
..................../config
......................../foo-config.xml
......................../foo-defs.xml
......................../foo-validations.xml
..................../jsp
......................../page1.jsp
......................../page2.jsp

I don't suppose you can define the validator/tiles plugin in both the default and module config files, and only define the set of rules/defs relevant to that module???

It's not a requirement that the default config file remain empty, just a "tradition" because we only have one WAR inside the EAR we deploy on WAS and it's got alot of legacy (non-struts) "applications". If we defined anything in the default config, it would just be a ForwardAction to our context root and forwards to module "welcome" URLs.

Thanks for any help,

Jason Berk
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
how can I configure my struts-config files to allow modules to define the validation rules and tiles definitions they (and only they) need, while defining cross application validations/tile-defs at the default struts config level?


You can't.

There is no "inheritance" between modules. If you define something in the struts-config.xml file at the root module, it does not get propagated to the other modules. Each module gets all of it's configuration from the configuration file and the validation files that pertain to that module.

If you wanted to centralize validation and tile-defs, the one thing you could do is make each of your module configuration files point to the same tile and validation definition files.
[ May 20, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using tiles & validator across modules