How do I get data from Tapestry BeanEditForms?
I'm using Tapestry 5 and I have a page on which I have a bean edit form. How do I get data submitted in that form 开发者_JAVA技巧after click on submit? I don't want to use Hibernate to persist the data (I'm using Spring JdbcTemplate
). I want to use the data from forms to add them to SQL query.
If you use a BeanEditForm
, you already have some kind of backing bean which you specified as the object
parameter. That's where the data for the form is coming from when the form is rendered, and that's also where it is going when the form is submitted.
The BeanEditForm
component contains a Form
component just like when you'd hand-code your form. You can create event handlers for all the standard events in your page class, just like you usually would:
@OnEvent(EventConstants.SUCCESS)
void processMyForm() {
//your code here
}
Also check out the Bean Edit Form Guide and the component reference for the BeanEditForm component on the Tapestry site.
精彩评论