Raible's Wiki
    Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu 
 
    
    
         
        Set your name in 
       
       
UserPreferences 
 Referenced by 
   JSPWiki v2.2.33 
    
       
 Hide Menu  | 
    
      
 
 How to add a Servlet into AppFuseThere 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. 
  | 
  ||||||