web.xml help - struts

V

Vijay

hi all,

I am having trouble specifying two servlets for two types of action
classes. My web.xml entries are as follows:
<servlet>
<servlet-name>adminaction</servlet-name>
<servlet-class>com.web.AdminActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>usersaction</servlet-name>
<servlet-class>com.web.UsersActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/users-struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>adminaction</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>usersaction</servlet-name>
<url-pattern>*.job</url-pattern>
</servlet-mapping>

My problem is that even the action-mappings defined in
struts-config.xml are appended .job instead of .do. And any of the
admin action is not accessible. (it gives me [RequestProcessor] Invalid
path /jobOptionsAct was requested error)
Though I am able to access the action mappings defined in
users-struts-config.xml with the .job url pattern.

Please help... Is it that we can not define two action servlets and two
struts-config files inside the same web application??

Vijay
 
T

Tobias Schierge

Please help... Is it that we can not define two action servlets and two
struts-config files inside the same web application??

Is it required that you use two different servlets? Otherwise you could
check for configuring multiple struts modules which can have different
config files.

Regards,

Tobias
 
W

Wendy S

Vijay said:
Please help... Is it that we can not define two action servlets and two
struts-config files inside the same web application??

I believe that's true, there should be only one controller. Although I
can't find it explicitly stated, all of the Struts documentation refers to
"the controller".

Struts does have the concept of 'modules' which will let you split the
application up into sections, such as your 'user' and 'admin'. You can have
multiple config files in that case.

Here's some documentation on configuring modules, I'm sure Google can turn
up more.
http://struts.apache.org/userGuide/configuration.html#dd_config_modules
 
V

Vijay

Hi Tobias and Wendy,

Thanks for making things clear. I also found that struts applications
must have only one controller.

Thankyou for helping...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top