It's really quite simple. What happens during a regular form
submission is that the browser includes a parameter based on the
button that was clicked. So if you have a button that looks like this
in HTML:
<input name="btnI" type="submit" value="I'm Feeling Lucky"/>
then when you click on it the browser will add the following to the
set of parameters posted:
btnI=I'm Feeling Lucky
Since Stripes knows ahead of time the set of events it can expect
(based on method names and @HandlesEvent annotations) it pokes into
the request and looks for any request parameters with a name that
matches one of the event names it knows about. When it finds one it
considers it a match and runs that event.
So to simulate it using a link you just add a parameter with the name
== eventName - the value doesn't matter. However, you shouldn't have
to concern yourself with this as you can just do:
<stripes:link beanclass="foo.bar" event="myEvent"/>
-t
On Sep 22, 2008, at 8:19 PM, farouk alhassan wrote:
I think a literal explanation on how stripes is able to determine
which button has generated the event will come in handy. this is
because a lot of the times, i get into the situation where the
action i am expecting will have to come from a link, not a button on
a form. But i don't know how to make a link behave like a form post
with the action name in the right place
for stripes to pick up. I have had to resort to passing in a
parameter and letting the default handler handle the event and using
the parameter to tell which method to call.
Cheers
--- On Mon, 9/22/08, Freddy Daoud <[EMAIL PROTECTED]> wrote:
From: Freddy Daoud <[EMAIL PROTECTED]>
Subject: Re: [Stripes-users] Sending event name
To: "Stripes Users List" <[email protected]>
Date: Monday, September 22, 2008, 7:37 AM
Hi Cosmin,
A safer, more explicit, less 'hacky' way to do it is to use a hidden
input whose name is '_eventName' and value is the name of your event,
as in
<s:hidden name="_eventName" value="execute"/>
This would call public Resolution execute() on your action bean.
Cheers,
Freddy
http://www.stripesbook.com
On Mon, 22 Sep 2008 17:22:56 +0300, "Cosmin Marginean"
<[EMAIL PROTECTED]> said:
> Hello everyone,
>
> Again, I am running in a "best-practice" issue. I am trying to
submit a
> form to an action but not to it's default handler. For this, I saw
that
> having a submit button with the name of the event to be handled will
> submit to that event handler.
>
> However, I am not using a submit button (UI issues) and I need to
submit
> to this non-default handler. As I saw, I can use a hidden input
whose
> name is the name of the event (same as in the case of the submit
button
> input). This seems to work (at a first glance at least) but I was
> wondering if this can be avoided since it seems pretty "hacky"
to me, to
> be honest.
>
> Thanks,
> Cosmin Marginean
>
> --
> cosminaru.ro
--
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in
the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing
list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win
great prizes
Grand prize is a trip for two to an Open Source event anywhere in
the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users