RE: forwarding in an action/command

"Schnitzer, Jeff" <[email protected]>
Newsgroups gmane.comp.web.maverick.general
Message-ID <[email protected]>
> From: [email protected] [mailto:[email protected]]
> 
> Is the best way to forward to do this:
> 
> this.getCtx().getResponse().sendRedirect("unitDetails.m?id=" +
unitKey);
> 
> ?

That would be a redirect, not a forward... and it's not the best way to
do a redirect either :-)

If you want to do a redirect, that is one way - but you'll need to use
the "null" view type because you are issuing the redirect from the
controller.

A (usually) better way to perform a redirect is to use the "redirect"
view type.  From the controller call:

this.getCtx().setModel("unitDetails.m");
this.getCtx().setViewParam("id", unitKey);

Or you could just put the entire URL in the model, Maverick will figure
it out.  Also, you can specify the base part of the url as a path=""
attribute in the maverick config file.


For a forward, you probably want to use a "null" view type and use the
servlet RequestDispatcher mechanism.  It goes something like this:

RequestDispatcher disp =
this.getCtx().getRequest().getRequestDispatcher("blah.m");
disp.forward(this.getCtx().getRequest(), this.getCtx().getResponse());


You could also do the forward using the "document" view type, but it
gets harder to dynamically choose the path you want to go to.

Does this help?

Jeff Schnitzer
[email protected]


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
[INVALID FOOTER]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.