Home of: [Atelier "FUJIGURUMA"] >> [PageMixer hosted by SourceForge.net]

SEE "For Readers of English Version",
or Japanese version of this page

Configure Struts

This section explains how to configure Struts("struts-config.xml").

Describe "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>

Mapping of Servlet

"mainMenu.page" Servlet is mounted on "/mainMenu.page". This makes difference between "mainMenu.page" Servlet and "mainMenu.jsp" suffix (".page" or ".jsp") only.

Describe "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>

"struts-config.xml" in struts-mailreader of Struts

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>

"struts-config.xml" of sample implementation

Mixing with Struts

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.

  1. Copy obj/java/webapps/demo-struts to another (below, there is noteted as $(DEMO_STRUTS))
  2. Copy struts.jar(and any other required libraries) under $(DEMO_STRUTS)/WEB-INF/lib
  3. Copy 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.