You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by RogerV <ro...@googlemail.com> on 2009/12/10 16:10:01 UTC

Convention Plugin - Action Chaining

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


Re: Convention Plugin - Action Chaining

Posted by Musachy Barroso <mu...@gmail.com>.
So it is finding a jsp that it think it is the result, that's why it
is not doing the forward.

On Fri, Dec 11, 2009 at 1:48 AM, RogerV <ro...@googlemail.com> wrote:
>
>
>
> Musachy Barroso wrote:
>>
>> If they are in the same package that should work, all I can advise is
>> to put a breakpoint in ConventionUnknownHandler, line 301 and see what
>> is going on.
>>
>
> Hi Musachy
>
> At line 301 if (result == null && resultCode != null) result is an instance
> of ServletDispatcherResult with a location attribute of
> /WEB-INF/content/foo.jsp and resultCode is a string with value "bar". The
> comparison fails and jumps to line 317 returning /WEB-INF/content/foo.jsp
>
> Regards
>
> --
> View this message in context: http://old.nabble.com/Convention-Plugin---Action-Chaining-tp26728788p26741424.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
>
>

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


Re: Convention Plugin - Action Chaining

Posted by RogerV <ro...@googlemail.com>.


Musachy Barroso wrote:
> 
> If they are in the same package that should work, all I can advise is
> to put a breakpoint in ConventionUnknownHandler, line 301 and see what
> is going on.
> 

Hi Musachy

At line 301 if (result == null && resultCode != null) result is an instance
of ServletDispatcherResult with a location attribute of
/WEB-INF/content/foo.jsp and resultCode is a string with value "bar". The
comparison fails and jumps to line 317 returning /WEB-INF/content/foo.jsp

Regards

-- 
View this message in context: http://old.nabble.com/Convention-Plugin---Action-Chaining-tp26728788p26741424.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


Re: Convention Plugin - Action Chaining

Posted by Musachy Barroso <mu...@gmail.com>.
If they are in the same package that should work, all I can advise is
to put a breakpoint in ConventionUnknownHandler, line 301 and see what
is going on.

musachy

On Thu, Dec 10, 2009 at 7:10 AM, RogerV <ro...@googlemail.com> wrote:
>
> 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
>
>

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