Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseAddServlet


This is version 1. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]


How to add a Servlet into AppFuse

There are some things that an AppFuse application can't do "out-of-the-box." Sometimes the best way to incorporate the needed functionality will be by adding a servlet. Adding a servlet into your AppFuse application is a pretty simple process... when you know all the steps.

1. Install dependancy libraries. Please refer to the step-by-step guide to adding libraries into AppFuse. your servlet class is located in a library, then skip to step 3b.

2. Add the servlet class(es) into /src/web/.

3. Create the configuration for your servlet. There are two ways to do this step..

3a. Add XDoclet tags into your servlet to have the configuration generated automatically at build time.

/**
 * @web.servlet
 *     display-name="Me New Servlet"
 *     load-on-startup="3"
 *     name="myservlet"
 *
 * @web.servlet-init-param
 *     name="myparam"
 *     value="${my.param.value}"
 *
 * @web.servlet-mapping
 *     url-pattern="/myservlet/*"
 */

3b. Or you can choose to add the servlet definition and mapping manually. This is done by adding entries into:

/metadata/web/servlets.xml

    <servlet>
        <servlet-name>myservlet</servlet-name>
        <servlet-class>org.appfuse.web.action.MyServlet</servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>

/metadata/web/servlet-mappings.xml

    <servlet-mapping>
        <servlet-name>myservlet</servlet-name>
        <url-pattern>/myservlet/*</url-pattern>
    </servlet-mapping>

4. \Optional\ Exclude your servlet from being decorated by SiteMesh. You may need to add an exclude entry into:

/web/WEB-INF/classes/decorators.xml

    <excludes>
        <pattern>/myservlet/*</pattern>
    </excludes> 

5. \Optional\ Exclude your servlet from requiring a login. See the page on security settings in AppFuse.



Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:42 MST by NathanAnderson.