hello everyone:
i know that the struts1.1beta has supported multiple controllers,but it is still the beta version,till now,nobody mentioned how to implement multiple controllers by using struts1.0,i wonder if i can implement multiple controllers by using struts1.0 as follow:
1 write two empty class,each of them extends "org.apache.struts.action.ActionServlet".
2 register them in the "web.xml" file.
3 assign different properties file and config files to them.
follow is the "web.xml" file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>controller1</servlet-name>
<servlet-class>scioworks.sample.survey.struts.Controller1</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>scioworks.sample.survey.struts.survey1</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/config1.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>controller2</servlet-name>
<servlet-class>com.jhtop.pim.forum.Controller2</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>com.jhtop.pim.forum.forum</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/config2.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>controller1</servlet-name>
<url-pattern>/controller1/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>controller2</servlet-name>
<url-pattern>/controller2/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/html</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/logic</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
</web-app>
after that,you can write you application to use the controllers,but i find that the "controller2" work s well,but the "controller1" can't read the properties file,i mean that when it read the "<bean:message......>" tag,in the
jsp page,it throws "missing message for key......" exception.
why?who will like to take a try?and give me your result?