У меня проблема, описанная в заголовке. Мой selectOneMenu не меняет мое значение: /
<h:column>
<f:facet name="header">
<h:outputText value="Vorgesetzter" />
</f:facet>
<h:outputText
value="#{s.manager.surename}, #{s.manager.forename}"
rendered="#{not s.editable}" />
<h:selectOneMenu value="#{s.manager.userID}"
styleClass="inputlabel" id="Vorgesetzter"
rendered="#{s.editable}">
<f:selectItem
itemValue="${null}" itemLabel="-"/>
<f:selectItems value="#{userBean.userList}" var="us"
itemLabel="#{us.surename}, #{us.forename}"
itemValue="#{us.userID}" />
</h:selectOneMenu>
</h:column>
<h:column>
<h:commandButton value="bearbeiten"
action="#{sectionBean.switchEdit(s)}"
rendered="#{not s.editable}" />
<h:commandButton value="speichern"
action="#{sectionBean.updateSection(s)}"
rendered="#{s.editable}" />
<h:commandButton value="abbrechen"
action="#{sectionBean.switchEdit(s)}"
rendered="#{s.editable}" />
</h:column>
это часть section.xhtml. Он связан с тегом формы.
Это мой боб:
package at.ac.htlperg.beans;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import at.ac.htlperg.dao.SectionDAO;
import at.ac.htlperg.model.Section;
@ManagedBean
@SessionScoped
public class SectionBean {
SectionDAO sectionDAO;
public SectionBean() {
sectionDAO = new SectionDAO();
}
public SectionDAO getSectionDAO() {
return sectionDAO;
}
public void setSectionDAO(SectionDAO sectionDAO) {
this.sectionDAO = sectionDAO;
}
public List<Section> getSectionList() {
return sectionDAO.getSectionList();
}
public String deleteSection(Section s) {
sectionDAO.deleteSection(s);
return null;
}
public String switchEdit(Section s) {
sectionDAO.switchEdit(s);
return null;
}
public String saveSection() {
sectionDAO.saveSection(sectionDAO.getSection());
return "/secured/sealed/sections.xhtml";
}
public String updateSection(Section s) {
sectionDAO.updateSection(s);
this.switchEdit(s);
return null;
}
}
метод updateSection должен обращаться к базе данных и выполняет session.update (s).
Но он не сохраняет новые значения ни в selectOneMenu, ни в обычном текстовом поле выше (не в показанном коде).
Кто-нибудь знает, что не так?