Incidentally I hit a similar issue when trying to write a generic JPA based Action. If you're interested the code is here...
http://svn.opensymphony.com/svn/sandbox/able/sandbox/able-core/src/main/java/com/opensymphony/able/action/JpaCrudActionSupport.java basically I got the idea from this page... http://mc4j.org/confluence/display/stripes/Binding+Into+Domain+Models where I create a preBind() method which is invoked via the overloaded setContext(context) method which is where I do any pre-bind stuff (such as setting things up so that I can load persistent entities before properties are set on them etc). So you could maybe do something similar and in a preBind() method, load the account from wherever (via hidden ID or grab it from the HttpSession or whatnot). So right now I'm looking for 'special request parameters' in the preBind() such as the primary keys of persistent objects, processing those in the preBind() method so that when Stripes binds form values to properties of POJOs things all work. On 9/16/06, Patrick Lightbody <[EMAIL PROTECTED]> wrote: > I'm writing an "Update Account" page where a user can set his email > address and password, among other things. The first thing I tried was > a @Before method that pulled in the current user and assigned it to > the "account" field, hoping it happened before "account.email", > "account.firstName", etc were applied. No such luck. > > The next thing I thought about trying was a nice type converter for > all accounts. A hidden ID of could be used to specify the "account" > parameter as a the current user's ID. > > This works but is very insecure. The simplistic way to handle this is > to simply check the account ID against the current user ID before > allowing anything to go further in my action bean. This works fine, > but I'd really love to not have to specify the ID at all in my form. > Rather, wouldn't it be nice if my type converter understood a value > of "currentUser" and pulled that in? I had hoped it could work, but > the TypeConverter interface doesn't supply the ActionBeanContext. > > So, two questions: > > 1) Is the hidden ID + ID check the common way to do this in stripes? > 2) Why can't the TypeConverter get the ActionBeanContext? > > Patrick Lightbody > Autoriginate, Inc. > 503-488-5402 > http://www.autoriginate.com > [EMAIL PROTECTED] > > "Intelligent testing made convenient" > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Stripes-development mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/stripes-development > -- James ------- http://radio.weblogs.com/0112098/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Stripes-development mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-development
