struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RogerV <roger.var...@googlemail.com>
Subject Convention Plugin - Action Chaining
Date Thu, 10 Dec 2009 15:10:01 GMT

I'm trying to get action chaining to work as described in the section
chaining at http://struts.apache.org/2.1.6/docs/convention-plugin.html. My
Foo action and bar actions are listed below. What happens is that when Foo
is called, it correctly displays foo.jsp. When foo.jsp is submitted it fills
in the value of platformId, I see the message "Platform selected" on the
console and then foo.jsp is redisplayed and I don't see the message "Foo-Bar
is called". If I change return "bar" to a nonsense string that doesn't refer
to anything, I still get foo.jsp redisplayed when I would expect a "No
Result Defined for Action Foo and result <nonsense string>" exception.

Any idea what I'm doing wrong?

Regards

public class Foo extends ActionSupport {

	private int platformId;
	private Services services;

	public String execute() {

		System.out.println("SelectPlatform.execute()");
		if (platformId > 0) {
			System.out.println("Platform selected");
			return "bar";
		}
		
		return SUCCESS;
	}

	public  List<Platform> getPlatforms() {
	   	return services.listAllPlatforms();
	    }
	
	public int getPlatformId() {
		return platformId;
	}

	public void setPlatformId(int platformId) {
		this.platformId = platformId;
	}
}

public class EditPlatformData extends BaseAction {

	private int platformId;
	
@Action("foo-bar")
	public String execute() {
		System.out.println("Foo-Bar is called");
		return SUCCESS;
	}

	public int getPlatformId() {
		return platformId;
	}

	public void setPlatformId(int platformId) {
		this.platformId = platformId;
	}
}
-- 
View this message in context: http://old.nabble.com/Convention-Plugin---Action-Chaining-tp26728788p26728788.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message