db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Quinton McCombs" <qmcco...@nequalsone.com>
Subject RE: [documentation] contributing init servlet
Date Wed, 29 Jan 2003 15:43:34 GMT
You contribution is very much appreciated!  

We have Wiki setup for Turbine & Torque at
http://nagoya.apache.org/wiki/apachewiki.cgi?TurbineProjectPages.  If
you are not familiar with Wikis, look at
http://nagoya.apache.org/wiki/apachewiki.cgi?ApacheWiki.  Basically,
this is a place where anyone create create and modify the pages.  

Please take a lokk around and feel free to add a new page with the
information you just posted about the initialization servlet.  Mailing
lists are great but they can be difficult to use to find information by
searching the archives sometimes.

> -----Original Message-----
> From: Maurice Wijtten [mailto:maurice@dieka.com] 
> Sent: Wednesday, January 29, 2003 9:08 AM
> To: turbine-torque-dev@jakarta.apache.org
> Subject: [documentation] contributing init servlet
> 
> 
> Hello Torque developers,
>  
> I was introduced with Torque by the usage of it in Jetspeed. 
> I was very fascinated about the developing speed. One of the 
> disadvantages is the documentation. An important rule at 
> having critics is helping to get it better! I don't now if my 
> contribution is welcome, but if might help beginning 
> programmers a bit on the way. I found that writing a little 
> initservlet is a very simple way of combining Torque and Struts 
> together. The code fragments in this mail are my 
> TorqueInitServlet and the code fragment of web.xml which has 
> to be inserted. If any help is appreciated i have no trouble 
> writing a little tutorial describing the install of torque 
> together with Struts.
>  
> I hope my help can contribute the project,
>  
> Maurice Wijtten, the Netherlands
> Maurice@dieka.com
>  
>  
>  
>  
> <?xml version="1.0" encoding="ISO-8859-1"?>
>  
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>  
> <web-app>
>  
>   
>   
>   <servlet>
>     <servlet-name>TorqueInitServlet</servlet-name>
>  
> <servlet-class>nl.mycompany.startup.TorqueInitServlet</servlet-class>
>     <load-on-startup>0</load-on-startup>
>   </servlet>
>   
> </web-app>
>  
>  
>  
>  
> And the TorqueInitServlet
>  
>  
> /*
>  * Servlet.java
>  *
>  * Created on January 21, 2003, 10:41 AM
>  */
>  
> package nl.mycompany.startup;
>  
> import java.io.*;
> import java.net.*;
>  
> import javax.servlet.*;
> import javax.servlet.http.*;
> import org.apache.torque.*;
>  
> /**
>  * Initialisation Servlet which is called automaticaly at
>  * the start of the servlet container.
>  * Don't forget the  <load-on-startup>  in web.xml
>  * @author  Maurice Wijtten
>  * @version 1.0
>  */
> public class TorqueInitServlet extends HttpServlet {
>     
>     /** Initializes the servlet.
>      */
>     
>     
>     public void init(ServletConfig config) throws ServletException {
>         super.init(config);
>         try{
>         System.out.println("Initializing Torque");
>         String TorqueProperties = 
> config.getServletContext().getRealPath("/WEB-INF/conf/Torque.p
> roperties"
> );
>         Torque.init(TorqueProperties);
>         System.out.println("Torque has been initialized.");
>         }
>         catch(org.apache.torque.TorqueException te){
>             te.printStackTrace();
>         }
>     }
>     
>     /** Destroys the servlet.
>      */
>     public void destroy() {
>         
>     }
>   
> }
> 

Mime
View raw message