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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Are the struts tags xhtml compliant ?

542


What is the purpose of @createifnull annotation annotation?

623


What is difference between lookupdispatchaction and dispatchaction?

633


What is the purpose of '@customvalidator'?

582


Which technologies can be used at view layer in struts?

647






How is the action mapping specified?

556


What is Struts2?

629


What is apache struts vulnerability?

548


In which order struts framework searches for a message bundle?

562


For a single Struts application, can we have multiple struts-config.xml files?

585


What is life cycle of an interceptor?

551


Why aren’t the struts tags maintained as part of the jakarta taglibs project ?

551


Describe the basic steps used to create a tiles application?

557


What is the purpose of @results annotation?

720


What is struts2 in java?

536