• Post Reply Bookmark Topic Watch Topic
  • New Topic

actions are not servlets..then what is the purpose of adding servlet elements for action in web.xml  RSS feed

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actions are not servlets right? then why do i have to add servlet elements for the action classes in my web.xml? but in my project they have added only the servlets in the web.xml not the actions... can anyone please explain it??
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action are not servlets, correct. But there is an ActionServlet (the "controller") that determines what action will handle each request. It's configured in the web.xml because that's where you configure servlets.

Actions are configured in the Struts configuration file because they're framework-specific classes--nothing to do with default Java web application mechanisms. They *could* have used a configuration mechanism that leveraged the web.xml file, I suppose (although I'm not sure if that capability existed when Struts 1 first came about), but it's separate, which makes sense to me.
 
Prakash Mani - Attur
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry.. i have removed the servlet elements from the web.xml except the actionservlet, that worked fine..its my mis understanding... can anyone please tell what are the init params we can have in servlet element in the web.xml...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!