Hi Darryl,

It's very nice to hear that you are enjoying the book.

For the example that you mention: if you look at the bottom of
page 55(Paper) 65(PDF), you'll see that from the contact list page,
in contact_list.jsp, the "contactId" parameter is set to the
corresponding id of the contact on each row of the table, which is
retrieved using ${contact.id}. Now, when you click on an Update
link from the contact list, the contactId parameter will be sent
and used by the getContact() method of ContactBaseActionBean.java
to retrieve the contact. This allows to prepopulate the form.

At this point, you have the form in contact_form.jsp. When that
form is submitted, all fields of the contact entered or modified
by the user are sent, but, as explained on page 56(Paper) 66(PDF),
we need to resubmit the contact id parameter. The hidden input
is set to "contact.id" because here we are just resubmitting the
id that was set in the contact object. We don't need the contactId
parameter anymore; that was just to prepopulate the form upon
arrival.

Let me know if that helps. I hope you enjoy the rest of the book!

Cheers,
Freddy
http://www.stripesbook.com

On Mon, 29 Dec 2008 17:41:23 -0800, "Stoflet Darryl" <[email protected]>
said:
> Hi,
> 
> I am new to Stripes but have been very intrigued for quite some time. The
> other java web frameworks have always left a bad taste with me (overly
> complex, difficult to troubleshoot etc). When the Stripes book from
> pragprog
> came out I snapped up a copy.
> 
> So far I am pleased with the book and am taking my time absorbing it and
> following along with the examples (with slight customizations for my own
> better understanding). However I've run into an issue with the first
> contact
> form example and I am not sure if its something I did wrong when
> customizing
> the example or if there is a typo. On pg 55 there is a hidden form field
> and
> its name is set to contact.id. However, the checks within the ActionBean
> are
> for contactId, so when an update is submitted that contact is not found
> and
> thus not updated.
> Should the example hidden tag use a name of contactId rather than
> contact.id
> ?
> 
> Btw: The example is also in the freely available forms pdf here:
> http://media.pragprog.com/titles/fdstr/forms.pdf on page 8.
> 
> Thanks,
> Darryl

------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to