is it necessary to write struts-confing.xml ,what tags are
important in that xml file?

Answer Posted / rajasekhar

Yes, it is necessary to provide the configuration file. But
it is not compulsary that the name of the file should be
struts-config.xml. We need to configure the name of the
file in the deployment descreptor(web.xml) of the web
application.

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet </servlet-
class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-
value>
</init-param>.....
<servlet>

Important tag in the configuration files are:
<struts-config>
<form-beans>
<form-bean name=" employForm" class="com.emp.EmployForm"/>
</form-beans>
<global-forwards>
<forward name="success" path="success.jsp" />
</global-forwards>
<global-exceptions>
<excetption key="some.key" type="ExceptionType"
path="SomeException.jsp" />
</global-exception>
<action-mappings>
<action path="/login" name="employForm"
type="com.emp.EmployAction" scope="request\session"
input="/login.jsp" validate="true/false" >
<forward name="success" path="/Mainpage.jsp" />
<forward name="failure" path="/Errorpage.sp" />
</action>
</action-mappings>
<controller
processorClass="org.apache.struts.action.RequestProcessor"/>
<message-resource parameter="applicationResources" />
</struts-config>

Is This Answer Correct ?    20 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How you will make available any message resources definitions file to the struts framework environment?

739


What is the purpose of @beforeresult annotation?

755


What are the advantages of spring mvc over struts mvc?

662


Why struts 1 classes are not thread safe whereas struts 2 classes are thread safe?

683


How the flow of various requests happens in struts application?

736


Explain how can we upload files in struts2 application?

808


How tag libraries are defined in Struts?

779


In how many ways duplicate form submission can occurs?

759


Explain about how requests from the client are sent?

674


Why do we need struts?

699


What is a custom tag?

700


Is Struts Framework part of J2EE?

769


How does interceptor work in struts2?

698


What do you mean by actionmapping?

729


What is the struts in java?

689