Matt, Yes this should help, thanks for your patience. As you might know It's not exactly the Person object but my variation on it. So I may be attempting to refer to the id field but not referring to the bean instance to get at the id field correctly. I'm in the middle of a transition from struts 1.x to struts2 so everything is still feeling a bit awkward.
Thanks again for your help, Ryan On Thu, May 1, 2008 at 11:54 AM, Matt Raible <[EMAIL PROTECTED]> wrote: > When id=1 comes in on the request (in the URL on a GET, hidden field > on a POST), it will be set on the Action provided there is a setId() > method. For the PersonAction, this works on GET, but not on POST. On > POST, the hidden fields name is "person.id", so it's setting it on the > Person object rather than the Action itself. > > Hope this helps, > > Matt > > On Thu, May 1, 2008 at 10:50 AM, Ryan Withers <[EMAIL PROTECTED]> > wrote: > > Matt, > > > > This makes it sound like something I'm doing, and I will double check > that > > again. Potentially the request parameter isn't being set correctly. > Yes > > I'm saying that editPerson.html isn't in all cases being passed the > > id=<value> parameter. In some cases the id is coming across as a > request > > parameter but I have to admit I need to pay more attention to what links > > produce which urls. I am getting the id before I call out to process an > > action, when I call out to process any action the id parameter is null > for > > me and to get around this I'm using the session. If you can provide any > > more insight that would be great. If not I can take this offline > because > > it's starting to look like I introduced a bug when going through the > > tutorial. > > > > Thanks, > > > > Ryan > > > > > > On Thu, May 1, 2008 at 11:26 AM, Matt Raible <[EMAIL PROTECTED]> > wrote: > > > You're saying that /editPerson.html?id=1 results in a null value in > > > the hidden field? > > > > > > Matt > > > > > > > > > > > > > > > On Thu, May 1, 2008 at 10:10 AM, Ryan Withers <[EMAIL PROTECTED]> > > wrote: > > > > Matt, > > > > > > > > The id does get set, but when the action methods get performed > either > > > > (edit, save, delete) the id is being set back to null. > > > > > > > > Thanks, > > > > > > > > Ryan > > > > > > > > > > > > > > > > On Thu, May 1, 2008 at 11:04 AM, Matt Raible <[EMAIL PROTECTED] > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > The id should be a hidden field so it's retained on an edit. The > > > > > tutorial shows this: > > > > > > > > > > <s:hidden name="person.id" value="%{person.id}"/> > > > > > > > > > > Matt > > > > > > > > > > > > > > > > > > > > > > > > > On Thu, May 1, 2008 at 9:58 AM, Ryan Withers < > [EMAIL PROTECTED]> > > > > wrote: > > > > > > Matt, > > > > > > > > > > > > In the posted example for the Struts 2 project there seems to > be > > an > > > > issue > > > > > > with the PersonAction where things are done in terms of the id > on > > the > > > > > > action. Trouble is this gets set, and then on a subsequent > request > > it > > > > winds > > > > > > up being null. So the call to save always creates a new row in > the > > > > table. > > > > > > I solved this by storing the id in the session when the setter > setId > > > > gets > > > > > > called. In fact many of the methods in the PersonAction now > look > > for > > > > the id > > > > > > being in the session vs. just looking at the instance id > variable. > > Am I > > > > > > losing my mind or should the example be updated? > > > > > > > > > > > > Thanks, > > > > > > > > > > > > Ryan > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >