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

Edit this page


Referenced by
Articles
Articles_cn
Articles_de
Articles_pt
Articles_zh




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseAddServlet


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.

NOTE: If 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="My 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   Edit this page   More info...   Attach file...
This page last changed on 06-Nov-2006 13:52:59 MST by NathanAnderson.