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
How you will make available any message resources definitions file to the struts framework environment?
What is the purpose of @beforeresult annotation?
What are the advantages of spring mvc over struts mvc?
Why struts 1 classes are not thread safe whereas struts 2 classes are thread safe?
How the flow of various requests happens in struts application?
Explain how can we upload files in struts2 application?
How tag libraries are defined in Struts?
In how many ways duplicate form submission can occurs?
Explain about how requests from the client are sent?
Why do we need struts?
What is a custom tag?
Is Struts Framework part of J2EE?
How does interceptor work in struts2?
What do you mean by actionmapping?
What is the struts in java?