Hi, For sure, there are many ways to obtain the result you want. Here are two examples: 1) Don't use a converter, but create an instance of the interface in a @Before method and set the property there. 2) Use a converter in the first URL and copy the ActionBean's property into another. Then you are free to do anything like using another converter.
I have a case that's similar to yours. I have an interface Dataset with 2 different implementations. My ActionBeans usually support both implementation. So to update an instance of Dataset, I have an URL like "/dataset?dataset=S-MyDataset" where S- is the implementation. The complete dataset is obtained by the database so properties are populated and can be modified. I didn't have anything special to do. Now, if your property is not obtained from a database and the sub-property cannot be populated automatically, you may wish to do the following: 1) Use an URL like My.action?someInterface=someValue 2) Use a converter that creates an instance of your interface and sets the someProperty property inside the instance. 3) Your JSP doesn't need to change since you can use someInterface.someProperty that has the right value. 4) When the form is submitted the same converter will create the appropriate instance of the SomeInterface and will set an incorrect value inside someProperty, but Stripes will override the property since Stripes guaranties that it will set properties of an object in the order of the deepness of the property. So if you have a value for someInterface and someInterface.someProperty, Stripes will set someInterface then someInterface.someProperty. Problem solved! Christian -----Message d'origine----- De : Thomas Menke [mailto:stripe...@cipher-code.de] Envoyé : February-11-12 7:08 PM À : Stripes Users List Objet : Re: [Stripes-users] Stripes:select: force to use the value attribute? On 02/10/2012 02:55 PM, Poitras Christian wrote: > Hi, > > To answer to your questions: > 1. Yes, it's the intended behaviour. As it's specified in most Stripes' tags > like text > (http://stripes.sourceforge.net/docs/current/taglib/stripes/text.html), > Stripes tag uses the value attribute only if the ActionBean's properties is > unavailable. > 2. As you can see in the best practices page > (http://www.stripesframework.org/display/stripes/Best+Practices), it's > recommended to pre-populate domain objects using @Before. I suggest you do > the same thing for all ActionBean's pre-population. It greatly simplifies the > initialisation of fields in JSPs. I have an interface with a property: interface SomeInterface { public void setProperty(String value); } And an ActionBean that gets this interface as a parameter from URL like this: My.action?someInterface.someProperty=someValue class MyActionBean implements ActionBean { public SomeInterface someInterface; // ... } Now of course due to the nature of an interface stripes can't instantiate the interface. But from the value of someProperty I can derive the information which class is needed. Thus I wrote a converter that looks at the value, creates an object of appropriate type and populates the property. Unfortunately this means that I gave to change to URL above to the following: My.action?someInterface=someValue This seemed to be really smart to me but: If I access a value for reading in my JSP, then I the path to my variable is someInterface.someProperty, but in the URL it is just someInterface in order to trigger the converter. Well, I can think of a couple of ways to change my structure. I hoped I could implement it like described with stripes form-tags... > > Christian Thomas ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users