• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i implement multiple controlers in struts?

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
in struts,we use one servlet controler and config it in struts-config file,but in my program,i want separate controler for each set of related functionality,how can i do?
thanks for any helps!
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't really recommend that unless you have a truly complex website with very distinct differences in how the fundamental dispatching is being done or you have a compelling reason to keep several independent struts-config.xml files (which basically means that you're running multiple webapps).
You specify the Struts controller servlet in the web.xml file. Also in web.xml you specify the URL mappings. So you can run multiple servlets -- or multiple instances of the standard Struts servlet -- just by adding mappings.
 
Elizabeth Reynolds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't you just extend ActionServlet with a different servlet name for each web app and then pass a different config object in the init parameters for each servlet?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic