MAP | PageMixer Documents > Tutorial > Mixing with Struts > Configure Struts | << | >> |
This section explains
how to configure Struts("struts-config.xml
").
web.xml
"Servlet mapping part of configuration in former section of this tutorial is shown below again.
<servlet-mapping> <servlet-name> mainMenu.page </servlet-name> <url-pattern> /mainMenu.page </url-pattern> </servlet-mapping>
"mainMenu.page
" Servlet is mounted on
"/mainMenu.page
".
This makes difference between "mainMenu.page
" Servlet and
"mainMenu.jsp
" suffix
(".page
" or ".jsp
") only.
struts-config.xml
"Now,
it is assumed that JSP files are replaced by Servlet
mounted at same point suffix
(not ".jsp
" but ".page
") excepted.
Then, rename path suffix in
"input
"(of "action
") or
"path
"(of "forward
")
from ".jsp
" to ".page
"
For example,
"struts-config.xml
" in struts-mailreader of Struts
has below configuration.
<!-- Edit mail subscription --> <action path="/editSubscription" type= "org.apache.struts.webapp.example.EditSubscriptionAction" name="subscriptionForm" scope="request" validate="false"> <forward name="failure" path="/mainMenu.jsp"/> <forward name="success" path="/subscription.jsp"/> </action>
Above configuration is modified as shown below.
<!-- Edit mail subscription --> <action path="/editSubscription" type= "org.apache.struts.webapp.example.EditSubscriptionAction" name="subscriptionForm" scope="request" validate="false"> <forward name="failure" path="/mainMenu.page"/> <forward name="success" path="/subscription.page"/> </action>
Now, everything needed are ready to use.
You can render result of "Action
" in Struts
with PageMixer framework.
Steps to build web application image with sample are shown below.
Please see "README.en.txt" and
build all@demo/struts/war/
by Apache ANT before them.
obj/java/webapps/demo-struts
to another
(below, there is noteted as $(DEMO_STRUTS)
)
struts.jar
(and any other required libraries)
under $(DEMO_STRUTS)/WEB-INF/lib
struts-mailreader/WEB-INF/classes
(of Struts)
under $(DEMO_STRUTS)/WEB-INF
For example,
you can place $(DEMO_STRUTS)
in
webapps
under CATALINA_BASE
of Jakarta Tomcat.
MAP | PageMixer Documents > Tutorial > Mixing with Struts > Configure Struts | << | >> |