Hi, I am a beginner learning about java language and netbeans, and have a few questions I would like to ask. I want to create a new JSP page to allow a user to add new attributes/items, or to update the attributes in a database/table that I already have. How should I go around doing that? I already have dragged a table to the new JSP page, and dragged my database/table to the table on that page, and when I run that page on the web browser, my table appears. Am i supposed to create a button that allows the user to add new attributes, and key in some coding in the button?

Thanks.

I already have figured out how to insert attributes to a table in the web browser, but I can't save the new attributes. This is how my coding for the save button looks like,

public String save_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        try {

           if (instancedataDataProvider.getRowCount() > 0) {
               instancedataDataProvider.cursorFirst();
               do{
                   if(instancedataDataProvider.getValue("INSTANCEDATA.INSTANCEID").equals
                           (new Integer(0))) {
                       instancedataDataProvider.setValue("INSTANCEDATA.INSTANCEID",
                               new Integer(newInstanceID));
                       newInstanceID++;

                       if(instancedataDataProvider.getValue("INSTANCEDATA.INSTANCENAME").equals
                               (new Integer(0))) {
                           instancedataDataProvider.setValue("INSTANCEDATA.INSTANCENAME",
                                   new Integer(newInstanceName));
                           newInstanceName++;
                       }

                   }
               } while (instancedataDataProvider.cursorNext());
           }
           instancedataDataProvider.commitChanges();
        } catch (Exception ex) {
            log("Error Description", ex);
            error("Error :+ex.getMessage()");
        }

        return null;
    }

I know the code has some errors, but I do not know where and how to start solving the errors.

Help will be greatly appreciated, thanks so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.