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
while working struts in intellij 7.0error unable to initialize tld location cache: zip file is closed is displayed anybdy can answer me immdialy .ungert
Why is it called struts?
Why we use struts over servlets?
What do struts do?
What are action errors and error and what are the consequences they impose?
How we can controlled duplicate form submission in struts?
How does one create an action in struts 2?
Explain the life cycle of a request in struct2 application?
Which interceptor is responsible for mapping request parameters to action class Java Bean properties?
What is the purpose of struct-config.xml in struct2?
How to display validation errors on jsp page?
List some struts tag libraries?
How exceptions are handled in struts application?
What are the classes used in struts?
What do you mean by tiles in struts?