What are the contents of web.xml and struts-config.xml? What is the difference between them? How to relate these tow xml files?

Showing Answers 1 - 3 of 3 Answers

Mamata Jagati

  • Dec 28th, 2006
 

web.xml is used for the deployment descriptor for web applications where struts-config.xme is used for deployment descripror for struts application.

 Struts-config.xml is used for making connection between view & controller where as web.xml is used for making connection between web container & web application

  Was this answer useful?  Yes

venkat soma

  • Jan 5th, 2007
 

what Mamata told is absolutely correct. One more difference is:

web.xml will be read by container when we start the container.

struts-config.xml will be read by init() method of ActionServlet.

  Was this answer useful?  Yes

karthik

  • Mar 11th, 2007
 

in eclipse select Run--->run then select the arguments tab and give your stuff

  Was this answer useful?  Yes

upendra_kumar2001

  • May 29th, 2007
 

The web.xml is deployment descriptor for the web application and is used for the connection between web container and web application.

where as

struts-config.xml is deployment descriptor for the struts-config.xml and is used for the connection between view and the controller layer.

  Was this answer useful?  Yes

Well,
What mamta and venkat have said is the epitome for answer of this question.
I am combining both of their answers of eaiser reference.

(1) web.xml is the DD [deployment descriptor] for any web based application while struts-config.xml is for specifically struts based application. what this means is that for different frameworks like SPRING, SEAM etc web.xml would be same but struts-config.xml might be different:)
(2) web.xml establishes connection b/w application and container whereas
struts-config.xml abridges gap b/w view and controller
(3) web.xml is read by the container when its made up and running 'n' appcn is deployed WHILE struts-config.xml is read by the ActionServlet's init() method [which it over-rides from GenericServlet]

Vinay

  Was this answer useful?  Yes

web.xml: It is a deployment descriptor file. The contents of web.xml are servlet, servlet-mapping, filter, Resources for
JNDI, Message resources of properties file to make i18n application. Defining the authentications. all the
TLDs are describe in wb.xml
it gives u the information about the whole application .

Struts-config.xml:
It is struts configuration file. In which define the Form Bean, Action (which action has to perform), we also configure redirection
URL for success and failures. It only gives the information of Struts Action
How they relate?

When user send the request for a particular page . It firstly goes to web. xml, and through configure parameter it goes to struts-config.xml where it found the suitable action mapping tag. perform the Action.

Thanks

In any web application when the client sends for a particular page then first it loads the web.xml it is also called as deployment descriptor. and in the web.xml we provide what actions has to take place like which files are added to jvm and what type of servlets are loaded at stating of the application.strurts-config.xml is struts configuration file it is loaded into jvm by web.xml only and in struts configuration file we provided the what classes has to be touched when user sends the request.

  Was this answer useful?  Yes

Sunil Patil.

  • Apr 29th, 2014
 

Go through run configuration -->Click on Arguments-->Click on Variables button you will get popup with diffrenet type of commnad line arguments.

  Was this answer useful?  Yes

kishore

  • Dec 19th, 2014
 

web.xml,struts-config.xml and struts.xml all are different.

  Was this answer useful?  Yes

kishore

  • Dec 19th, 2014
 

web.xml file used for deployment descriptor and struts-config.xml file used for configure the controller and views pages................

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions