AW: [opencms-dev] calling servlet from jsp

Frank Wunderlich k.frank.wunderlich at gmx.de
Thu Jun 12 11:44:00 CEST 2003


Hi Philipp,

I think, it's just like in any other webapplication:

1. The servlet classes have to be visible in the classpath of the
opencms webapp.
That means they have to be placed somewhere down the
opencms/WEB-INF/classes directory (or WEB-INF/lib for jars).
As far as I know, but I'm not quite sure about that, they are
automatically published to this place, when you store your classes
inside a opencms module (e.g. system/module/mymodule/classes).

2. The next step is to register the servlet class in web.xml 

    <servlet>
      <servlet-name>action</servlet-name>
 
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
	...
    </servlet>  
        
    <!-- Standard Action Servlet Mapping -->
    <servlet-mapping>
      <servlet-name>action</servlet-name>
      <url-pattern>/struts/*</url-pattern>
    </servlet-mapping> 

3. Just place a link to your servlet url somewhere in your
opencms-templates / pages / whatever...

As you can see, you can even integrate a MVC-framework like Apache
Struts easily into Opencms. The views/jsps used by Struts can even be
edited inside Opencms.

Greetings,
Frank. 

> 
> 
> Hi :)
> 
> I want to use a Servlet with OpenCMS 5.0.
> 
> Has anyone informations about using servlets in OpenCMS 5.0?
> 
> 
> Greetings
> 
> Philipp
> 
> 
> 
> 
> 
> Enrico Olla schrieb:
> 
> >Hi List,
> >
> >I wrote some servlet for my application and now I saved 
> these classes 
> >in system/module/mymodule/classes. Now I want process some 
> data from a 
> >form in a jsp created in /MyProject I tried to perform the 
> form action 
> >with /servlet/myservlet but not work.
> >
> >What is the correct way to call a servlet in my module?
> >
> >Thanx,
> >Olen.
> >
> >
> >
> >_______________________________________________
> >This mail is send to you from the opencms-dev mailing list
> >To change your list options, or to unsubscribe from the list, please 
> >visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> >
> >
> >  
> >
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 





More information about the opencms-dev mailing list