Jane Eisenstein wrote:

I would like to be able to forward to the existing servlets from Struts
code in a manner that will not need to change when a servlet is replaced
by an equivalent action. Could I use a ForwardAction action to forward
to the servlets?
Are you sure you mean "forward"? The example you provided wasn't a forward.

You can forward inside the Struts framework to any path you want, action or not, by putting the complete path in your forward definition:

<forward name="foobar" path="/BazServlet"/>

Then when BazServlet is replaced by an action you'd just change the forward name. In your example, however, you're putting the contents of a servlet into a frame, which isn't a Struts forward, and it's outside of the Struts framework, so you don't have transparent access to anything inside Struts (like the forward definitions).

The forwards defined in Struts config are designed to be used within Actions (or their helpers) by saying things like:

mapping.findForward("name_of_forward");

If that page is being generated by a Struts/JSP (or other presentation methodology) you could, say, put the forward's target into an appropriate scope and render it via scriptlet, JSTL, or your presentation side's equivalent.

I could be completely misunderstanding the problem, too. But it seems like you want access to Struts from the outside, not access to the outside from _inside_ Struts (which is trivial). It's still doable, perhaps someone more knowledgable than myself could talk about accessing the Struts config from the outside, or you could parse the parts you're interested in, or something.

Dave

-----Original Message-----
From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 19, 2005 3:32 PM
To: Struts Users Mailing List
Subject: Re: how forward to servlets?

Jane Eisenstein wrote:

...
What am I doing wrong?

Mixing Struts and servlets ;)

Creating a forward doesn't create an action--what is logonServlet.do? If
it isn't an action, then why would it have a .do extension? When the
request processor sees a .do (if you're set up to do extension-based
struts mappings) it'll try to fire an Action.

Also, you can't use a forward definition in a non-struts anything,
because only struts knows about forwards.

If you are just using a servlet as the contents of a frame then you
don't need to interact with struts at all.

Dave

Reply via email to