You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Suman Maity <ma...@yahoo.com> on 2007/04/10 12:41:33 UTC

Struts module switch

Hi,
   I was trying struts module switching and was successful doing it using
SwitchAction. I am also using tiles. The problem is I am not able to use a
separate tiles definition file for the other module (i have two modules).  
I have two struts config files. struts-config.xml for the default module and
struts-anotherModule-config.xml for the other module.
I have written the following in the default struts config file
(struts-config.xml):
<plug-in className="org.apache.struts.tiles.TilesPlugin">
  		<set-property property="definitions-config"
value="/WEB-INF/conf/tiles-defs.xml"/>
  		<set-property property="definitions-debug" value="1"/>
  		<set-property property="definitions-parser-details" value="0"/>
  		<set-property property="definitions-parser-validate" value="true"/>
	</plug-in>

I had created another tiles definition file for the other module with a name
tiles-anotherModule-defs.xml and created some definitions in that. 
I mentioned this file in struts-anotherModule-config.xml file in the same
way as above. In this struts config i wrote a action mapiping which has
forward tag like this: <forward name="switchModule" path="actionExamples">
The definition of actionExamples is there in the second tiles definition
file that is the tiles-anotherModule-defs.xml file.

When I run the app, the module switch occurs with the help of SwitchAction
but finally it fails to load the definition actionExamples saying "Can not
get request dispatcher for path actionExamples". 

Now, the irony is that instead of specifying a seperate tiles definition
file, I write the following line in struts-anotherModule-config.xml file:
<plug-in className="org.apache.struts.tiles.TilesPlugin"/>
Put the definition actionExamples in the default tiles def file and it
works. I even don't need to mention the tiles def file's name here although
it simply works. But if i comment the above line, it does not work. I am
confused.
Can not I use separate tiles definition files for separate modules each
having its own struts config file?
Please provide example  if possible.
Thanking in advance.
-- 
View this message in context: http://www.nabble.com/Struts-module-switch-tf3552250.html#a9917277
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts module switch

Posted by Niall Pemberton <ni...@gmail.com>.
On 4/11/07, Suman Maity <ma...@yahoo.com> wrote:
>
> Well, could u then let me know how to modularize my struts config in case it
> grows large. How do I modularize my struts web app without having separate
> struts modules. I am working on a web project where there are three types of
> users:Admin, Web User and Call Center User. Under each of these there are
> several screens/modules.  Currently we are maintaining only one struts
> config and tiles def file and their sizes are becoming a issue. Also I would
> like to use separate application resources properties files for different
> user types. Could u give me suggestions on how to overcome  these issues?

You can have multiple struts-config.xml files in one module - you just
specify a comm separated list of the file names in the web.xml - take
a look at the struts-examples webapp shipped with the latest version
of struts - the validation "module" is broken up in suahc a way.

Niall

> Still I would like to have an answer to my original question, if possible.
> As I have already told that I have been able to do module switching, but
> still I haven't been able to use a separate tiles definition file for the
> second module. If u could help me out at this, I will be thankful to you.
> Being able to use a separate tiles def file for the second module (having a
> struts config file of its own) will do for me.
>
> pbenedict wrote:
> >
> > Have you considered removing the use of modules? Modules are really a
> > nuisance, and were originally developed to allow multiple Struts "apps"
> > running under one context. There's a hard barrier between modules and
> > almost all developers I know no longer use them. You can split up your
> > struts config without using modules.
> >
> > I know this advice doesn't answer your question, but think about it,
> > because it will save you time.
> >
> > Paul
> >
> > Suman Maity wrote:
> >> Hi,
> >>    I was trying struts module switching and was successful doing it using
> >> SwitchAction. I am also using tiles. The problem is I am not able to use
> >> a
> >> separate tiles definition file for the other module (i have two modules).
> >> I have two struts config files. struts-config.xml for the default module
> >> and
> >> struts-anotherModule-config.xml for the other module.
> >> I have written the following in the default struts config file
> >> (struts-config.xml):
> >> <plug-in className="org.apache.struts.tiles.TilesPlugin">
> >>              <set-property property="definitions-config"
> >> value="/WEB-INF/conf/tiles-defs.xml"/>
> >>              <set-property property="definitions-debug" value="1"/>
> >>              <set-property property="definitions-parser-details" value="0"/>
> >>              <set-property property="definitions-parser-validate" value="true"/>
> >>      </plug-in>
> >>
> >> I had created another tiles definition file for the other module with a
> >> name
> >> tiles-anotherModule-defs.xml and created some definitions in that.
> >> I mentioned this file in struts-anotherModule-config.xml file in the same
> >> way as above. In this struts config i wrote a action mapiping which has
> >> forward tag like this: <forward name="switchModule"
> >> path="actionExamples">
> >> The definition of actionExamples is there in the second tiles definition
> >> file that is the tiles-anotherModule-defs.xml file.
> >>
> >> When I run the app, the module switch occurs with the help of
> >> SwitchAction
> >> but finally it fails to load the definition actionExamples saying "Can
> >> not
> >> get request dispatcher for path actionExamples".
> >>
> >> Now, the irony is that instead of specifying a seperate tiles definition
> >> file, I write the following line in struts-anotherModule-config.xml file:
> >> <plug-in className="org.apache.struts.tiles.TilesPlugin"/>
> >> Put the definition actionExamples in the default tiles def file and it
> >> works. I even don't need to mention the tiles def file's name here
> >> although
> >> it simply works. But if i comment the above line, it does not work. I am
> >> confused.
> >> Can not I use separate tiles definition files for separate modules each
> >> having its own struts config file?
> >> Please provide example  if possible.
> >> Thanking in advance.
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Struts-module-switch-tf3552250.html#a9934530
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Struts module switch

Posted by Suman Maity <ma...@yahoo.com>.
Well, could u then let me know how to modularize my struts config in case it
grows large. How do I modularize my struts web app without having separate
struts modules. I am working on a web project where there are three types of
users:Admin, Web User and Call Center User. Under each of these there are
several screens/modules.  Currently we are maintaining only one struts
config and tiles def file and their sizes are becoming a issue. Also I would
like to use separate application resources properties files for different
user types. Could u give me suggestions on how to overcome  these issues?

Still I would like to have an answer to my original question, if possible. 
As I have already told that I have been able to do module switching, but
still I haven't been able to use a separate tiles definition file for the
second module. If u could help me out at this, I will be thankful to you.
Being able to use a separate tiles def file for the second module (having a
struts config file of its own) will do for me.



pbenedict wrote:
> 
> Have you considered removing the use of modules? Modules are really a 
> nuisance, and were originally developed to allow multiple Struts "apps" 
> running under one context. There's a hard barrier between modules and 
> almost all developers I know no longer use them. You can split up your 
> struts config without using modules.
> 
> I know this advice doesn't answer your question, but think about it, 
> because it will save you time.
> 
> Paul
> 
> Suman Maity wrote:
>> Hi,
>>    I was trying struts module switching and was successful doing it using
>> SwitchAction. I am also using tiles. The problem is I am not able to use
>> a
>> separate tiles definition file for the other module (i have two modules).  
>> I have two struts config files. struts-config.xml for the default module
>> and
>> struts-anotherModule-config.xml for the other module.
>> I have written the following in the default struts config file
>> (struts-config.xml):
>> <plug-in className="org.apache.struts.tiles.TilesPlugin">
>>   		<set-property property="definitions-config"
>> value="/WEB-INF/conf/tiles-defs.xml"/>
>>   		<set-property property="definitions-debug" value="1"/>
>>   		<set-property property="definitions-parser-details" value="0"/>
>>   		<set-property property="definitions-parser-validate" value="true"/>
>> 	</plug-in>
>>
>> I had created another tiles definition file for the other module with a
>> name
>> tiles-anotherModule-defs.xml and created some definitions in that. 
>> I mentioned this file in struts-anotherModule-config.xml file in the same
>> way as above. In this struts config i wrote a action mapiping which has
>> forward tag like this: <forward name="switchModule"
>> path="actionExamples">
>> The definition of actionExamples is there in the second tiles definition
>> file that is the tiles-anotherModule-defs.xml file.
>>
>> When I run the app, the module switch occurs with the help of
>> SwitchAction
>> but finally it fails to load the definition actionExamples saying "Can
>> not
>> get request dispatcher for path actionExamples". 
>>
>> Now, the irony is that instead of specifying a seperate tiles definition
>> file, I write the following line in struts-anotherModule-config.xml file:
>> <plug-in className="org.apache.struts.tiles.TilesPlugin"/>
>> Put the definition actionExamples in the default tiles def file and it
>> works. I even don't need to mention the tiles def file's name here
>> although
>> it simply works. But if i comment the above line, it does not work. I am
>> confused.
>> Can not I use separate tiles definition files for separate modules each
>> having its own struts config file?
>> Please provide example  if possible.
>> Thanking in advance.
>>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-module-switch-tf3552250.html#a9934530
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts module switch

Posted by Paul Benedict <pb...@apache.org>.
Have you considered removing the use of modules? Modules are really a 
nuisance, and were originally developed to allow multiple Struts "apps" 
running under one context. There's a hard barrier between modules and 
almost all developers I know no longer use them. You can split up your 
struts config without using modules.

I know this advice doesn't answer your question, but think about it, 
because it will save you time.

Paul

Suman Maity wrote:
> Hi,
>    I was trying struts module switching and was successful doing it using
> SwitchAction. I am also using tiles. The problem is I am not able to use a
> separate tiles definition file for the other module (i have two modules).  
> I have two struts config files. struts-config.xml for the default module and
> struts-anotherModule-config.xml for the other module.
> I have written the following in the default struts config file
> (struts-config.xml):
> <plug-in className="org.apache.struts.tiles.TilesPlugin">
>   		<set-property property="definitions-config"
> value="/WEB-INF/conf/tiles-defs.xml"/>
>   		<set-property property="definitions-debug" value="1"/>
>   		<set-property property="definitions-parser-details" value="0"/>
>   		<set-property property="definitions-parser-validate" value="true"/>
> 	</plug-in>
>
> I had created another tiles definition file for the other module with a name
> tiles-anotherModule-defs.xml and created some definitions in that. 
> I mentioned this file in struts-anotherModule-config.xml file in the same
> way as above. In this struts config i wrote a action mapiping which has
> forward tag like this: <forward name="switchModule" path="actionExamples">
> The definition of actionExamples is there in the second tiles definition
> file that is the tiles-anotherModule-defs.xml file.
>
> When I run the app, the module switch occurs with the help of SwitchAction
> but finally it fails to load the definition actionExamples saying "Can not
> get request dispatcher for path actionExamples". 
>
> Now, the irony is that instead of specifying a seperate tiles definition
> file, I write the following line in struts-anotherModule-config.xml file:
> <plug-in className="org.apache.struts.tiles.TilesPlugin"/>
> Put the definition actionExamples in the default tiles def file and it
> works. I even don't need to mention the tiles def file's name here although
> it simply works. But if i comment the above line, it does not work. I am
> confused.
> Can not I use separate tiles definition files for separate modules each
> having its own struts config file?
> Please provide example  if possible.
> Thanking in advance.
>   

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