Hello Reddy ,
First of all , When you post something on the forum , You need to keep patience for the other ranchers to help you out with your query. This is a helpful forum not an answer home where you put your query and it would automatically generate an answer.
Now , Lets come to the question in place ,
"I want to know how many struts-config.xml files that we can create in the same project.if we can create then how can we switch actions" Well , As and when the application size grows and each member of the team has to work on its own module , You can define seperate struts-config file specific to your module. This can be achieved like this :
In the deployment descriptor(web.xml) add an <init-param> element with its child elements i.e param-name and param-value something like this :
<init-param>
<param-name>config/module1</param-name>
<param-value>/WEB-INF/struts-module1-config.xml</param-value>
</init-param>
The new module is defined by adding an initialization parameter config/module1. In fact any init-param prefixed with "config/" is interpreted as configuration for a separate module.
Now when you want to switch between actions from struts-config to new created struts-config file , You would need to use SwitchAction details of which you can Google. Its much simpler to access it.
Now the second question :
How many properties files we can write.If we can write more than one properties file and If one message has to return from one properties file and we have more than one properties file. Then how to get that message value. This too can be any number of Message Resources file. For this in the struts-config file , You already have a default application resource bundle something similar to this :
<message-resources parameter="MessageResources_en" null="false"/>
Now when you want to add a new one , Just add one more element like this :
<message-resources key="yogendra" parameter="MessageResources_en" null="false"/>
Note the use of the
key attribute in the above message-resources element.
So, Configure as much as you want and give different key attributes for every different element and then when you want to use it on the
jsp , you need to do something similar to like this :
<bean:message key="UserRegistration.Title" bundle="yogendra"/>
Thats it Buddy.
Hope this helped you. If you have any further query , Just ping us.
Regards ,
Yogendra N Joshi.