how can you switch onemodule to another module by switch
action class plz explain with exapmle?



how can you switch onemodule to another module by switch action class plz explain with exapmle?..

Answer / m.gangadhar

hi,

let us a senario in our example we have two modules called
1.Module1
2.Module2

we have one main.jsp which is there in default module

main.jsp
--------
<html:form action="switch"?
prefix="/Module1"&page="/mod1.jsp"/>
<html:form action="switch"?
prefix="/Module2"&page="/mod2.jsp"/>
</html:form>

we have to take the struts-config.xml(default config file)
<action
type="org.apache.struts.actions.SwitchAction"
name=""
</action>

and dont forget to configure module specific configure
files in web.xml(mandatory)

<web-app>
<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>
<init-param>
<param-name>config/Module1</param-name>
<param-value>/WEB-INF/struts-module1-config.xml</param-
value>
</init-param>
<init-param>
<param-name>config/Module2</param-name>
<param-value>/WEB-INF/struts-module2-config.xml</param-
value>
</init-param>
</servlet>
...
...
</web-app>


and many more but these things r very inportant and other
is asusual normal struts program.

if ur not clarified plz mail to ur problem my email id
metari.gangadhar@gmail.com

bye

Is This Answer Correct ?    31 Yes 10 No

Post New Answer

More Struts Interview Questions

What kind of mvc is struts 2?

0 Answers  


What are the steps of struts installation?

0 Answers  


Can we use struts and spring together?

0 Answers  


How many types of action clases are there in stuts and their uses?

15 Answers   OHO, TCS, Wipro,


What is the purpose of @expressionvalidator annotation?

0 Answers  






What is discontinuous strut?

0 Answers  


how to write my own Action servlet by extending pre-defined Action servlet in struts config.

2 Answers   Sony,


What does action do in struts?

0 Answers  


What are the custom tags?

0 Answers  


Which interceptor is responsible for mapping request parameters to action class Java Bean properties?

0 Answers  


How to work with error tags?

0 Answers  


How to carryout the validations in struts if the validator frame work cant handle the validation

2 Answers   Syntel,


Categories