Simon Kitching пишет:
What do you mean by "stops working"?
I mean, when i pressing it, page simply reloads while backing bean
method not invoked.
And where is this "category" variable referenced in the delete method
declared? Why is it not null?
Oh, yes, here is all about category:
// members declaration:
private Category category;
private boolean editmode;
// Constructor: category initialized with empty domain object
public CategoryBean() {
category = new Category();
category.setParent(new Category());
}
[EMAIL PROTECTED] wrote:
Thank you for your answer.
Where should i else start looking ?
I think that i checked everything, the form finally shrinked down and
now it really simple:
<t:saveState value="#{CategoryBean.editmode}"/>
<h:form>
<h:inputText id="name" value="#{CategoryBean.category.name}"
required="true" maxlength="255" />
<h:message for="name" style="color: red" />
<h:commandLink action="#{CategoryBean.submit}" value="Save"
styleClass="cl" />
<h:commandLink action="#{CategoryBean.delete}" value="Delete"
styleClass="dl" rendered="#{CategoryBean.editmode}" />
</h:form>
and commandLink actions:
public String delete() throws SQLException {
CategoryDAO dao = SqlMapDAOFactory.getCategoryDAO();
int deleted = dao.deleteById(category.getId().intValue());
return "category_list";
}
public String submit() throws SQLException {
CategoryDAO dao = SqlMapDAOFactory.getCategoryDAO();
dao.update(category);
return "category_list";
}
But "Delete" button stops working if "Submit" was pressed before and
validation error occurs because of: required="true" in text field.
Everything looks pretty bulletproof :\