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

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

Configure Servlet

This section explains how to configure Servlet(using PageMixer) corresponded to JSP file(using Struts TagLib).

Overview

Class names

In this tutorial, abbreviated class names are used. Complete names are shown below.

Classes of PageMixer framework

NotationFull name
ContextFactory jp.ne.dti.lares.foozy.pagemixer.servlet.ContextFactory
DefaultPage jp.ne.dti.lares.foozy.pagemixer.page.DefaultPage
DefaultPageServlet jp.ne.dti.lares.foozy.pagemixer.servlet.DefaultPageServlet
DefaultPageServlet jp.ne.dti.lares.foozy.pagemixer.struts.DefaultPageServlet
FilterFactory jp.ne.dti.lares.foozy.pagemixer.servlet.FilterFactory
I18NDefaultPage jp.ne.dti.lares.foozy.pagemixer.page.I18NDefaultPage
I18NDefaultPageServlet jp.ne.dti.lares.foozy.pagemixer.servlet.I18NDefaultPageServlet
I18NDefaultPageServlet jp.ne.dti.lares.foozy.pagemixer.struts.I18NDefaultPageServlet
LocaleFactory jp.ne.dti.lares.foozy.pagemixer.servlet.LocaleFactory
LocalePage jp.ne.dti.lares.foozy.pagemixer.page.LocalePage
LocalePageServlet jp.ne.dti.lares.foozy.pagemixer.servlet.LocalePageServlet
LocalePageServlet jp.ne.dti.lares.foozy.pagemixer.struts.LocalePageServlet
MonoPage jp.ne.dti.lares.foozy.pagemixer.page.MonoPage
MonoPageServlet jp.ne.dti.lares.foozy.pagemixer.servlet.MonoPageServlet
MonoPageServlet jp.ne.dti.lares.foozy.pagemixer.struts.MonoPageServlet
PageServlet jp.ne.dti.lares.foozy.pagemixer.servlet.PageServlet
StrutsContextFactory jp.ne.dti.lares.foozy.pagemixer.struts.StrutsContextFactory
StrutsFilterFactory jp.ne.dti.lares.foozy.pagemixer.struts.StrutsFilterFactory
StrutsLocaleFactory jp.ne.dti.lares.foozy.pagemixer.struts.StrutsLocaleFactory

PageServlet again

How to use/configure PageServlet and classes derived from it is explained in "Mixing with Servlet".

PageMixer also provides classes derived from PageServlet to use MonoPage, LocalePage, DefaultPage and I18NDefaultPage for using in Struts environment. They are named as MonoPageServlet, LocalePageServlet, DefaultPageServlet and I18NDefaultPageServlet, too, but are placed in jp.ne.dti.lares.foozy.pagemixer.struts package.

Describe web.xml

Configuration example of the Servlet instead of mainMenu.jsp is shown below. This example uses LocalePageServlet for locale sensitive response renderring, even though you can choose MonoPageServlet to render response locale in-sensitively.

<servlet>
  <servlet-name>
    mainMenu.page
  </servlet-name>
  <servlet-class>
    jp.ne.dti.lares.foozy.pagemixer.struts.LocalePageServlet
  </servlet-class>
  <init-param>
    <param-name>
      forward.condition.0
    </param-name>
    <param-value>
      pagemixer.servlet.NotLoginCondition
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      filter.factory.0
    </param-name>
    <param-value>
      pagemixer.filter.UserFilter$Factory
    </param-value>
  </init-param>
  <init-param>
    <param-name>
      page.location
    </param-name>
    <param-value>
      page.mainMenu
    </param-value>
  </init-param>
</servlet>

    :

<servlet-mapping>
  <servlet-name>
    mainMenu.page
  </servlet-name>
  <url-pattern>
    /mainMenu.page
  </url-pattern>
</servlet-mapping>

Configuration of Servlet

"NotLoginCondition" forwards control to "login" page, when /mainMenu.page is accessed without authentication. But where should this forward control? where is "login" action?

In PageMixer/Struts co-operation demonstration, "path.logon" context-param is used to tell the location of "login" action to all NotLoginConditions in demonstration of co-operation with Struts, even though you can embed location of "login" page in NotLoginCondition code directly.

<context-param>
  <param-name>
    path.logon
  </param-name>
  <param-value>
    /logon.page
  </param-value>
</context-param>

Location of "login" action

This allows you re-configure web application without compilation.

Please see "Mixing with Servlet" for detail about the other init-params.


To next section "Configure Struts"