struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Struts Wiki] Update of "IssuesAndSolutions" by FrankZammetti
Date Wed, 29 Mar 2006 04:21:23 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Struts Wiki" for change notification.

The following page has been changed by FrankZammetti:
http://wiki.apache.org/struts/IssuesAndSolutions

New page:
= Issues And Solutions =

This page is meant to be a list of issues that users ave encountered while migrations existing
Struts Action 1.x application to Webwork, or developing new Webwork-based applications.  If
you have a solution to the issue that will of course be most helpful, but even if you don't
it is worth noting what you encountered none the less in the hopes that someone else can come
along and answer it for you, and the rest of us.


==== Webwork does not have an analogy to them Struts !ForwardAction. ====
One of the Struts "best practices" is that all requests within an application should go through
Struts.  So, you should generally never reference a JSP directly for instance.  To help with
this, Struts provides the !ForwardAction, which is more or less an Action that does nothing,
it just immediately returns and forwards to the URI as configured.  Webwork does not appear
to have a direct analogy to this.  However, it is easy to get the same effect in a couple
of possible ways.

First, you can write a simple Action like so:

{{{
package com.company.app;

import com.opensymphony.xwork.Action;

public class ForwardAction implements Action {

  public String execute() {
    return SUCCESS;
  }

}
}}}

Then, configure an Action like this:

{{{
<action name="justAForward" class="com.company.app.ForwardAction">
  <result name="success">pageToDisplay.jsp</result>
</action>
}}}

Now you can use that !ForwardAction whenever you like, just as you would in Struts.  Alternatively,
if you don't want to have a whole Action just for that, you can simply have a method in an
existing Action (named something other than execute, let's say "gotoJSP" for the sake of argument)
and configure an Action like so:

{{{
<action name="justAForward" class="com.company.app.SomeExistingAction" method="gotoJSP">
  <result name="success">pageToDisplay.jsp</result>
</action>
}}}

A few other alternatives were suggested, but it is easier to just reference the appropriate
forum post for you to look at: [http://forums.opensymphony.com/thread.jspa?threadID=23755&tstart=15]

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message