Re: [Stripes-users] form submit bug?

Subject:   Re: [Stripes-users] form submit bug? (find more)
From:  
Date:   Dec 29, 2005 20:40

Return-Path: <hidden>
Received: from [67.138.58.2] by web35602.mail.mud.yahoo.com via HTTP; Thu, 29 Dec 2005 17:40:34 PST
Message-ID: <hidden>
Date: Thu, 29 Dec 2005 17:40:34 -0800 (PST)
From: Nic Holbrook <hidden>
Reply-To: hidden
Sender: hidden
To: hidden
Subject: Re: [Stripes-users] form submit bug?
In-Reply-To: <hidden>
Errors-To: hidden
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Original-To: hidden
Delivered-To: hidden
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
  s=s1024; d=yahoo.com;
  h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding;
  b=6Z18brvEG2OQYLklFIGFUIWftt1CvIss0+NDhrZjbYNRkGnoDhIwwEjcMW4teF9AeuTXAfW1O/6mOlhLBHAsvm+psFLdppRZsFi3ZizI/B7PnIF1Yah93A/hsW08VQxez9jlRwc4kBFu5d7cIBMdbrr67JTt9ifQisgCra3IEeY=  ;
X-Spam-Score: 3.1 (+++)
X-Spam-Report: Spam Filtering performed by sourceforge.net.
 See http://spamassassin.org/tag/ for more details.
 Report problems to http://sf.net/tracker/?func=add&group_id=1&atid=200001
 0.5 FROM_ENDS_IN_NUMS      From: ends in numbers
 2.2 FORGED_YAHOO_RCVD      'From' yahoo.com does not match 'Received' headers
 0.4 FROM_HAS_ULINE_NUMS    From: contains an underline and numbers/letters
X-BeenThere: hidden
X-Mailman-Version: 2.0.9-sf.net
Precedence: bulk
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/stripes-users&gt;,
 <mailto:hidden?subject=unsubscribe>
List-Id: A list for dicussing building applications with Stripes. <stripes-users.lists.sourceforge.net>
List-Post: <mailto:hidden>
List-Help: <mailto:hidden?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/stripes-users&gt;,
 <mailto:hidden?subject=subscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum=stripes-users>
Status:

Well, you're right.  It does seem to work.  I must
have something else going on.  Anyway, I'll keep
tinkering. =20

Thanks


--- Tim Fennell <hidden> wrote:

> This sounds somewhat suspicious to me.  I've tested
> with image =20
> buttons before.  I went back and looked at the code
> and the =20
> AnnotatedClassActionResolver (which is also the
> parent of the Spring =20
> one) uses this code to resolve the event name:
>=20
>      public String getEventName(Class<? extends
> ActionBean> bean, =20
> ActionBeanContext context) {
>          Map<String,Method> mappings =3D
> this.eventMappings.get(bean);
>          Map parameterMap =3D
> context.getRequest().getParameterMap();
>=20
>          for (String event : mappings.keySet()) {
>              if (parameterMap.containsKey(event) ||=20
>=20
> parameterMap.containsKey(event + ".x")) {
>                  return event;
>              }
>          }
>=20
>          return null;
>      }
>=20
> It definitely checks for a Handler.x in addition to
> just Handler when =20
> scanning through the request properties (since you
> should always get =20
> both a .x and a .y, it's unnecessary to check for
> both).  I just put =20
> together a simple test case to make sure things work
> as I expect, and =20
> they do.  Here's the attached test code (you'll need
> TestNG).  =20
> Perhaps you could run this in your environment and
> see if it works?
>=20
> -t
>=20
> -------------------------Begin Java =20
> Class---------------------------------
> package net.sourceforge.stripes.controller;
>=20
> import net.sourceforge.stripes.action.UrlBinding;
> import net.sourceforge.stripes.action.ActionBean;
> import
> net.sourceforge.stripes.action.ActionBeanContext;
> import net.sourceforge.stripes.action.Resolution;
> import
> net.sourceforge.stripes.action.DefaultHandler;
> import net.sourceforge.stripes.action.HandlesEvent;
> import net.sourceforge.stripes.StripesTestFixture;
> import net.sourceforge.stripes.mock.MockRoundtrip;
> import org.testng.annotations.Test;
> import org.testng.Assert;
>=20
> /**
> * Tests that make sure the basic functions of the
> ActionResolver work =20
> as expected.
> *
> * @author Tim Fennell
> */
> @UrlBinding("/BasicResolverTests.action")
> public class BasicResolverTests implements
> ActionBean {
>      private ActionBeanContext context;
>      private int number;
>=20
>      public ActionBeanContext getContext() { return
> context; }
>      public void setContext(ActionBeanContext
> context) { this.context =20
> =3D context; }
>=20
>      public int getNumber() { return number; }
>      public void setNumber(int number) { this.number
> =3D number; }
>=20
>      @DefaultHandler @HandlesEvent("one")
>      public Resolution one() {
>          this.number =3D 1;
>          return null;
>      }
>=20
>      @HandlesEvent("two")
>      public Resolution two() {
>          this.number =3D 2;
>          return null;
>      }
>=20
>      // Start of Test Methods
>=20
>      @Test(groups=3D"fast")
>      public void testDefaultResolution() throws
> Exception {
>          MockRoundtrip trip =3D new MockRoundtrip=20
> (StripesTestFixture.getServletContext(),
> getClass());
>          trip.execute();
>=20
>          BasicResolverTests bean =3D
> trip.getActionBean( getClass() );
>          Assert.assertEquals(bean.getNumber(), 1);
>      }
>=20
>      @Test(groups=3D"fast")
>      public void testNonDefaultResolution() throws
> Exception {
>          MockRoundtrip trip =3D new MockRoundtrip=20
> (StripesTestFixture.getServletContext(),
> getClass());
>          trip.execute("two");
>=20
>          BasicResolverTests bean =3D
> trip.getActionBean( getClass() );
>          Assert.assertEquals(bean.getNumber(), 2);
>      }
>=20
>      @Test(groups=3D"fast")
>      public void testImageStyleResolution() throws
> Exception {
>          MockRoundtrip trip =3D new MockRoundtrip=20
> (StripesTestFixture.getServletContext(),
> getClass());
>          trip.execute("two.x");
>=20
>          BasicResolverTests bean =3D
> trip.getActionBean( getClass() );
>          Assert.assertEquals(bean.getNumber(), 2);
>      }
>=20
>      @Test(groups=3D"fast")
>      public void testImageStyleResolution2() throws
> Exception {
>          MockRoundtrip trip =3D new MockRoundtrip=20
> (StripesTestFixture.getServletContext(),
> getClass());
>          trip.addParameter("two.x", "381");
>          trip.execute();
>=20
>          BasicResolverTests bean =3D
> trip.getActionBean( getClass() );
>          Assert.assertEquals(bean.getNumber(), 2);
>      }
> }
>=20
> -------------------------End Java
> Class---------------------------------
>=20
> On Dec 29, 2005, at 1:28 PM, Nic Holbrook wrote:
>=20
> > What I really meant to say...
> >
> > I need to add a .x or a .y to my Handler inside
> the
> > action in order for it to get called.
> >
> > Thanks
> >
> >
> > --- Nic Holbrook <hidden> wrote:
> >
> >> Currently, when I use the standard image tag,
> >> stripes
> >> sends the handler name as Handler.x and Handler.y
> so
> >> I
> >> need to add a .x or a .y to my Handler inside the
> >> event handler.
> >>
> >> --- Tim Fennell <hidden> wrote:
> >>
> >>> Hey Nic,
> >>>
> >>> You're right that there is no stripes:image tag
> >> yet.
> >>>  It has been at the bottom
> >>> of the list of priorities because I don't think
> it
> >>> adds a tremendous amount of
> >>> value (using the HTML one gets you most of what
> >> you
> >>> need).  However, for
> >>> completeness it probably is time that an image
> tag
> >>> got added to Stripes.  Note
> >>> that using the plain HTML input type=3D"image"
> will
> >> be
> >>> understood by Stripes and
> >>> routed to the correct action/handler.
> >>>
> >>> For a bit more on what I'm thinking for a
> >>> stripes:image tag (and to add your own
> >>> thoughts) check out:
> >>>   http://stripes.mc4j.org/jira/browse/STS-14
> >>>
>=20
=3D=3D=3D message truncated =3D=3D=3D



=09=09
__________________________________________=20
Yahoo! DSL =C2=96 Something to write home about.=20
Just $16.99/mo. or less.=20
dsl.yahoo.com=20



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log file=
s
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick
_______________________________________________
Stripes-users mailing list
hidden
https://lists.sourceforge.net/lists/listinfo/stripes-users