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
What is the purpose of @before annotation?
Are interceptors thread safe?
What is actioncontext?
What is the purpose of @urlvalidator annotation?
How many action classes can be used in struts application?
Which file is used by controller to get mapping information for request routing?
What do you mean by inner class and anonymous class?
how to connect from struts to database through hibernet and where u can modify the class
What are action errors and error?
What are the contents on web.xml in struts application ?
Define struts?
Does Struts2 action and interceptors are thread safe?
Which design pattern the interceptors in struts2 is based on?
What is the difference between empty default namespace and root namespace?
How you will enable front-end validation based on the xml in validation.xml?