Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

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

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic