/*
* Copyright 2005-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.strecks.actiontest.actions;
import java.sql.Date;
import org.strecks.action.NavigableSubmitAction;
import org.strecks.action.navigable.NavigableLookupDispatchController;
import org.strecks.controller.annotation.Controller;
import org.strecks.injection.annotation.InjectRedirectHelper;
import org.strecks.navigate.annotation.NavigateForward;
import org.strecks.navigate.handler.ActionRedirectNavigationHandler;
import org.strecks.web.RedirectHelper;
/**
* @author Phil Zoio
*/
@Controller(name = NavigableLookupDispatchController.class)
public class SimpleNavigableSubmitAction implements NavigableSubmitAction
{
private String message;
private RedirectHelper helper;
public void preBind()
{
}
public void execute()
{
message = "Ran execute() method " + SimpleNavigableSubmitAction.class;
helper.setStatusMessage(message);
helper.addRequestParameter("executeParam", 100);
}
public void cancel()
{
message = "Ran cancel() method " + SimpleNavigableSubmitAction.class;
helper.setStatusMessage(message);
helper.addRequestParameter("cancelParam", new Date(System.currentTimeMillis()).toString());
}
@NavigateForward(handler = ActionRedirectNavigationHandler.class)
public String nextAction()
{
return "post_redirect_action";
}
@InjectRedirectHelper
public void setHelper(RedirectHelper helper)
{
this.helper = helper;
}
}