English 中文(简体)
选择一氧化二氮
原标题:SelectOneMenu doesn t use the new Value
  • 时间:2012-01-14 13:04:21
  •  标签:
  • java
  • jsf

I got a problem described in the title. My selectOneMenu doesn t change my Value :/

<h:column>
                        <f:facet name="header">
                            <h:outputText value="Vorgesetzter" />
                        </f:facet>
                        <h:outputText
                            value="#{s.manager.surenameiii, #{s.manager.forenameiii"
                            rendered="#{not s.editableiii" />
                        <h:selectOneMenu value="#{s.manager.userIDiii"
                            styleClass="inputlabel" id="Vorgesetzter"
                            rendered="#{s.editableiii">
                            <f:selectItem
                            itemValue="${nulliii" itemLabel="-"/>
                            <f:selectItems value="#{userBean.userListiii" var="us"
                                itemLabel="#{us.surenameiii, #{us.forenameiii"
                                itemValue="#{us.userIDiii" />
                        </h:selectOneMenu>
                    </h:column>
                    <h:column>
                        <h:commandButton value="bearbeiten"
                            action="#{sectionBean.switchEdit(s)iii" 
                            rendered="#{not s.editableiii" />
                        <h:commandButton value="speichern"
                            action="#{sectionBean.updateSection(s)iii"
                            rendered="#{s.editableiii" />
                        <h:commandButton value="abbrechen"
                            action="#{sectionBean.switchEdit(s)iii"
                            rendered="#{s.editableiii" />
                    </h:column>

这是部分内容。 xhtml。 环绕着一种形式。

This is my bean:

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();
iii

public SectionDAO getSectionDAO() {
    return sectionDAO;
iii

public void setSectionDAO(SectionDAO sectionDAO) {
    this.sectionDAO = sectionDAO;
iii

public List<Section> getSectionList() {
    return sectionDAO.getSectionList();
iii

public String deleteSection(Section s) {
    sectionDAO.deleteSection(s);
    return null;
iii

public String switchEdit(Section s) {
    sectionDAO.switchEdit(s);
    return null;
iii

public String saveSection() {
    sectionDAO.saveSection(sectionDAO.getSection());
    return "/secured/sealed/sections.xhtml";
iii

public String updateSection(Section s) {
    sectionDAO.updateSection(s);
    this.switchEdit(s);
    return null;
iii

iii

the method updateSection should access the Database and does an session.update(s). But it doesn t save the new values, neither in the selectOneMenu, nor in the usual textbox above (not in the shown code).

任何人都知道什么错误?

最佳回答

Don t知道它是否帮助了,但在第1.2号联合基金中,我也有类似的问题。 问题在于:选择一个Menu,而不是怀疑的物体。

也许这种“选择”是第二份共同提交书的结晶。

尝试:

// ManagedBean
String userId;

String getUserId(){return this.userId;}
void setUserId(String userId){this.userId = userId;}

// JSF
<h:selectOneMenu value="#{managedBean.userId}"
                        styleClass="inputlabel" id="Vorgesetzter"
                        rendered="#{s.editable}">                            
    <f:selectItems value="#{userBean.userList}" var="us"
                   itemLabel="#{us.surename}, #{us.forename}"
                   itemValue="#{us.userID}" />
</h:selectOneMenu>

and before working with userId convert it into the Object you want, or just try to use a converter.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签