On Wed, 16 Jul 2003, Greg Roll wrote:

> Date: Wed, 16 Jul 2003 12:50:32 -0600
> From: Greg Roll <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: How to forward to a custom servlet
>
> May be a simple question, but I'm having a hard time figuring out how to
> configure my struts-config.xml file to allow me to setup an action mapping
> that forwards to a custom servlet.  We have a servlet implementation that
> calls a crystal report viewer... the viewer take a request and response
> object.  Essentially, when the action is called, I want the servlet to take
> over control of the window and display a report. Sounds simple... but I
> can't figure out what the path should be to the servlet....
>
> I'm using JBoss 3.2 with a tomcat 4.2.1 implementation....
>
> I have the class in the /WEB-INF/classes/com/foo/bar/CrystalViewer.class
> directory...
>
> I tried setting my action mapping up as follows but get a servlet not
> available error...
>
>         <action path="/ReportView"
>                 type="org.apache.struts.actions.ForwardAction"
>
> parameter="/WEB-INF/classes/com.foo.bar.crystal.CrystalViewer">
>         </action>
>
> I've tried a number of different parameters....
> /com.foo.bar.crystal.CrystalViewer
> /com/foo/bar/crystal/CrystalViewer
> /WEB-INF/classes/com/foo/bar/crystal/CrystalViewer
>
> None of which work...
>
> Any ideas what I'm doing wrong?!?!
>

You have to define the Crystal Reports servlet in your web.xml file, along
with a mapping for it (making sure that you maintain the required order of
elements in this file):

  <servlet>
    <servlet-name>Crystal Reports Viewer</servlet-name>
    <servlet-class>com.foo.bar.crystal.CrystalViewer>
  </servlet>

  <servlet-mapping>
    <servlet-name>Crystal Reports Viewer</servlet-name>
    </url-pattern>/crystal</url-pattern>
  </servlet-mapping>

and then your parameter value in the Action would be "/crystal" (the
context relative path to the viewer servlet.

> Greg
>
>

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to