0

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.

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by jlovesfishiee
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.