简体   繁体   中英

Issues passing data from the UI into a database - JSF, JPA, etc

im having a bit of an issue trying to pass the value entered in the ui to a specific table and column in the database, however when i submit this value to be passed i get the error

WARNING:   #{markingBean.markSectionOne}: java.lang.UnsupportedOperationException: Not supported yet.
javax.faces.FacesException: #{markingBean.markSectionOne}: java.lang.UnsupportedOperationException: Not supported yet.

in the glassfish console

i am using netbeans, jsf, derby db

 <p:spinner id="ajaxspinner80-100" value="#{markingBean.spinnerNumber1}" 
                                               stepFactor = "1"  min="80" max="100" disabled = "#{formBean.number != 8}">  
                                        <p:ajax update="ajaxspinnervalue" process="@this" />  
                                    </p:spinner> 

    <p:commandButton action="#{markingBean.markSectionOne}" value="#{bundle.buttonSave}" update=":growl" icon="ui-icon-disk"/>

Above is how the user selects the value and it is then passed to a bean :

public void markSectionOne() {
        this.markToCreate.create(this.markToCreate);
    }

however it looks like this is the reason for the error

public void create(Marking markToCreate) {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

i have found that code on the bottom on my Marking entity class,

the question i have is how can i insert the value from the spinner into my table marking under markSectionOne column ?

Thanks

You need an intermediary between the UI and the database. You should never think about it as "spinner into my table" or any other UI element.

Do it in steps:

  1. Get the UI form POST to the intermediary. Validate and bind the incoming data.
  2. Process the incoming data and persist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM