Interesting variety of suggestions, thanks all ...
I did move over to the VelocityAction and my silly little action now says
hello.
Thanks for the suggestion about ActionEvent.
However, just a note about setTemplate(). Actually it isn't necessary if you
are not changing the template. I just expected the action to reload the
same screen with data.Messsage set to my messge.
Use setTemplate() to redirect to a new template. I notice that some of the
examples take this value from a form field. That's a pretty slick way to do
it.
This works...
******************
HelloAction.java
******************
package org.mycompany.newapp.modules.actions;
import org.apache.turbine.modules.actions.VelocityAction;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
public class HelloAction extends VelocityAction
{
public void doHello (RunData data, Context context) throws Exception
{
data.setMessage("This is the HelloAction checking in. Everything is
okay here");
}
public void doPerform(RunData data, Context context) throws Exception
{
data.setMessage("Button not found!");
}
}
Cheers!
-JP
>From: "Weaver, Scott" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: RE: Action
>Date: Mon, 22 Oct 2001 13:38:40 -0400
>
>You forgot to set the template that will do the presentation for this
>action.
>
>Example: (probably the effect your hoping for ;)
>
>setTemplate(data, "HelloActions.vm");
>
>
>By default, an action does not have a presentation assigned to it. Your
>action, in its present form, probably takes to the Login.vm/Index.vm no?
>
>I would also suggest using the VelocityAction instead of the plain old
>Action if you are using Velocity. VelocityAction will put the Velocity
>context object into the actions you extend from it. Take a look at the
>Flux
>modules, they are an excellent non-trivial example of how to use and extend
>and use Screens and Actions.
>
>Scott
>
>-----Original Message-----
>From: Jonathan Porterfield [mailto:[EMAIL PROTECTED]]
>Sent: Monday, October 22, 2001 1:07 PM
>To: [EMAIL PROTECTED]
>Subject: Action
>
>
>I've looked through this a gazillion times. I must be missing something
>really simple, but am just not getting it. Please someone have a look.
>
>It's a very basic Action, just for Actions sake.
>
>Problem description:
>Always returns "Button not found!"
>
>From:
>******************
>HelloAction.java
>******************
>package org.mycompany.newapp.modules.actions;
>
>import org.apache.turbine.modules.Action;
>import org.apache.turbine.util.RunData;
>
>public class HelloAction extends Action
>{
> public void doHello (RunData data) throws Exception
> {
> data.setMessage("Hello from your action.");
> }
>
> public void doPerform(RunData data) throws Exception
> {
> data.setMessage("Button not found!");
> }
>}
>
>******************
>HelloActions.vm
>******************
><form method="post"
>action="$link.setPage("HelloActions.vm").setAction("HelloAction")">
>
><input type="submit" name="eventSubmit_doHello" value="Say Hello">
><hr />
>
>#if ($data.Message)
> $data.Message
>#end
>
>
>
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]