You could use an @Before method to load the current user. (Or only replace the current user if it is null, but that's not that clean IMO.)
Regards, Levi Op 1 mei 2010 om 18:04 heeft rplus <bariskar...@gmail.com> het volgende geschreven:\ > > Would you describe what you mean by "faking a property"? > > Problem here is that, if i use one of the user.firstName and > user.lastName > textfields in the jsp each single of them bind to the parameter > successfully. But when i try to more than one field, only one them > binds and > the other ones stay null. i check the request parameters i can see > that all > of them are there, just not bound. > > as for your advices; I already use the property pattern. Infact, as > you can > see that I need to use the getter to perform an update operation. If > I were > able to bind these properties, i have the intention of using strict > binding. > For the other ones, I'll consider them after this problem is solved, > so > thanks. > > Also, some other things that i noticed are; > for each parameter i passed to the actionBean, updateuser getter > invokes > seperately from what i can see from the console outputs. Is that > normal? > and if commented out the updateuser = userManager.getCurrent() user > line, i > can see that bindings will successful. Would you be able to suggest > some > other way to bind the new properties into the old one? > > Thanks anyway for your concern. > > > > Richard23 wrote: >> >> I'm not sure. IMO the problem is that you are "faking" a property - >> thats just a blind shot. Try to set the log level of the stripes >> framework to debug. Then stripes will tell you about binding >> problems. >> >> Last but not least try to improve the code by: >> - Try to not break the Property Pattern. This means private member >> with a setter and getter. The automatic binding mechanism of stripes >> depends on this convention. >> - Try to use <input type="text" name="updateuser.name" /> instead of >> <input type="text" name="updateuser.name" value="someOtherVariable"/ >> >. >> Stripes automatically invokes the getter for you, so there is no need >> to explicitly set the value. >> - Try to do clean MVC. This meas load the data from your service >> classes and store it in actionBean properties. In your jsp access the >> actionBean properties >> - Try to make use of StrictBinding annotation to avoid security >> issues >> and annotate all bindable setters with @Validate >> >> Regards, >> Richard >> >> On Fri, Apr 30, 2010 at 10:34 PM, rplus <bariskar...@gmail.com> >> wrote: >>> >>> >>> >>> Richard23 wrote: >>>> >>>> Wold you be so kind to post the relevant parts of the jsp and the >>>> setUser method? >>>> >>>> Are you using @StrictBinding? >>>> >>>> >>> >>> this is the action bean and there is no strict binding. >>> >>> public Resolution update() { >>> System.out.println(updateuser.getLastName()); >>> System.out.println(updateuser.getFirstName()); >>> System.out.println(updateuser.getName()); >>> userManager.updateUser( updateuser); >>> >>> return new JavaScriptResolution(resolutionObject); >>> } >>> private User updateuser; >>> public User getUpdateuser(){ >>> updateuser = userManager.getCurrent(); >>> return updateuser; >>> } >>> >>> public void setUpdateuser(User user){ >>> this.updateuser = user; >>> } >>> >>> >>> this is jsp : >>> >>> <s:form action="${contextPath}/settings/profile/update" >>> onsubmit='ajaxify({e: event, form: this});'> >>> <input type="text" name="updateuser.firstName" >>> value="${actionBean.currentUser.firstName}" /> >>> <input type="text" name="updateuser.name" >>> value="${actionBean.currentUser.name}" /> >>> <input type="text" name="updateuser.lastName" >>> value="${actionBean.currentUser.lastName}" /> >>> <s:submit name="update">update</s:submit> >>> </s:form> >>> >>> and this is model >>> >>> public class User extends ProfileBase { >>> >>> @Column(name = "first_name", length = 40) >>> private String firstName; >>> @Column(name = "last_name", length = 40) >>> private String lastName; >>> >>> } >>> >>> only one of the firstname or lastname fields bind. userManager is >>> also an >>> ejb local interface. >>> What can be the problem? >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Stripes-Binding-Problem-tp28411715p28416439.html >>> Sent from the stripes-users mailing list archive at Nabble.com. >>> >>> >>> --- >>> --- >>> --- >>> --- >>> ------------------------------------------------------------------ >>> _______________________________________________ >>> Stripes-users mailing list >>> Stripes-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/stripes-users >>> >> >> >> >> -- >> Richard Hauswald >> Blog: http://tnfstacc.blogspot.com/ >> LinkedIn: http://www.linkedin.com/in/richardhauswald >> Xing: http://www.xing.com/profile/Richard_Hauswald >> >> --- >> --- >> --- >> --------------------------------------------------------------------- >> _______________________________________________ >> Stripes-users mailing list >> Stripes-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/stripes-users >> >> > > -- > View this message in context: > http://old.nabble.com/Stripes-Binding-Problem-tp28411715p28421700.html > Sent from the stripes-users mailing list archive at Nabble.com. > > > --- > --- > --- > --------------------------------------------------------------------- > _______________________________________________ > Stripes-users mailing list > Stripes-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ _______________________________________________ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users