But you don't have to create any classes to provide an action path
abstraction for a JSP page. There are (at least) a couple of built-in
ways to do this:

1:
<action-mappings>
  <action path="/welcome"
          forward="/WEB-INF/jsp/welcome.jsp"/>
</action-mappings>

2:
<action-mappings>
  <action path="/welcome"
          type="org.apache.struts.actions.ForwardAction"
          parameter="/WEB-INF/jsp/welcome.jsp"/>
</action-mappings>

In both cases, "/do/welcome" gets you to "/WEB-INF/jsp/welcome.jsp". If
you decide later that "/do/welcome" should take you some place else, or
you need to interpose an action into the request processing, all that
changes is the action definition in your config file. The client
interface to the app doesn't change, it still uses "/do/welcome". To my
mind, this is the way to establish the separation between interface and
implementation for web apps.

As to the poster's original question ;-), I have no idea why it's not
working. I've made extensive use of both approaches under 1.0.2 without
a problem.

chanoch wrote:
> 
> i'm not complaining but I have this weird feeling that I've been
> involuntarily enrolled into school again..... (dodgy string music ensues)
> 
> In our project we create an action instance even for (straight) forwards in
> case we decide to add processing after the fact or to allow for multiple
> clients because I hate changing my JSPs after they have been created - as
> they are only arrived at with bloodshed. I can see why you would want to
> avoid creating unnecessary classes tho.
> 
> chanoch
> 
> ----- Original Message -----
> From: "Emmanuel Boudrant" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, October 14, 2002 10:04 PM
> Subject: RE: action include or forward attribute not working?
> 
> > But it violate MVC model 2, with only one controller.
> >
> > Ted wrote:
> >
> > In a Model 2 environment, the pages are suppose to be pretty but stupid.
> Flow to a page should go
> > through an
> > Action first, and the Action should assemble all the data that a page
> might need and put it into
> > the request or session context. The page then just grabs what it needs,
> and figures out how to
> > display it. The Action
> > may not known the address of the page (that's in the config file), but it
> does need a punch list
> > of what data the page may require. Every page should have an Action
> handler. One Action may handle
> > several different
> > pages, or a page could be handled by several different Actions (e.g. an
> error page), but each page
> > should have at least one handler.
> >
> > If a JSP ends up on your browser's address bar after the initial index
> page, then you're missing
> > an Action ;-)
> >
> > -emmanuel
> >
> > >
> > >
> > > >From: "Chappell, Simon P" <[EMAIL PROTECTED]>
> > > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > >Subject: RE: action include or forward attribute not working?
> > > >Date: Mon, 14 Oct 2002 15:24:00 -0500
> > > >
> > > >Actually, I have no problem seeing *.jsp. MVC only requires that the
> Model,
> > > >View and Controller be separated. Using a mix of *.do and *.jsp is not
> > > >going to violate MVC.
> > > >
> > > >For simple pages that require no pre-processing, we used direct calls
> to
> > > >the JSP.
> > > >
> > > >Simon
> > > >
> > > >-----Original Message-----
> > > >From: Hookom, Jacob John [mailto:[EMAIL PROTECTED]]
> > > >Sent: Monday, October 14, 2002 3:19 PM
> > > >To: Struts Users Mailing List
> > > >Subject: RE: action include or forward attribute not working?
> > > >
> > > >
> > > >Kael, this is MVC, you should never see *.jsp ;-)
> > > >
> > > >We went over this before in lab
> > > >
> > > >-----Original Message-----
> > > >From: Teh, Kah Loong
> > > >Sent: Mon 10/14/2002 3:15 PM
> > > >To: Struts Users Mailing List
> > > >Cc:
> > > >Subject: RE: action include or forward attribute not working?
> > > >
> > > >
> > > >
> > > >like you said, since you don't need an action ....
> > > >try using <html:link>
> > > >i.e., <html:link page="/registration.jsp"> register here </html:link>
> > > >
> > > >-kael Teh
> > > >
> > > >-----Original Message-----
> > > >From: Andy Kriger [ mailto:[EMAIL PROTECTED]]
> > > >Sent: Monday, October 14, 2002 3:16 PM
> > > >To: Struts Users Mailing List
> > > >Subject: action include or forward attribute not working?
> > > >
> > > >
> > > >I am setting up the following: a JSP containing a form; the submit
> > > >action of the JSP calls a Struts Action class. Since I don't really
> need
> > > >an action simply to forward to the JSP, I thought I'd use the action
> > > >include or foward attribute which seems to accomplish this. But I can't
> > > >make it work.
> > > >
> > > >Here is the struts-config entry...
> > > >
> > > ><action path="/Registration"
> > > >         forward="/registration.jsp">
> > > ></action>
> > > >
> > > >I would expect that /Registration.do would open registration.jsp
> > > >
> > > >Instead I get '500 No action instance for path /Registration could be
> > > >created'
> > > >
> > > >Any ideas?
> > > >
> > > >thx
> > > >andy
> > > >
> > > >
> > > >
> > > >
> > > >--
> > > >To unsubscribe, e-mail:
> > > >< mailto:[EMAIL PROTECTED]>
> > > >For additional commands, e-mail:
> > > >< mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > > >--
> > > >To unsubscribe, e-mail:   <
> > > >mailto:[EMAIL PROTECTED]>
> > > >For additional commands, e-mail: <
> > > >mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > _________________________________________________________________
> > > MSN Photos is the easiest way to share and print your photos:
> > > http://photos.msn.com/support/worldwide.aspx
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > >
> >
> > ___________________________________________________________
> > Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
> > Yahoo! Mail : http://fr.mail.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to