/*ERROR in FormViewer.java*/            DB_Test rsTest = new DB_Test();
/*- org.ifoc.form.server.DB_Test can not be found in source packages.
Check the inheritance chain from your module;
 it may not be inheriting a required module or a module may not be
adding its source path entries properly.*/

Structure:
/src
    -org.ifoc.form
        -FormViewer.gwt.xml
    -org.ifoc.form.client
        -FormViewer.java ERROR¿?
    -org.ifoc.form.server
        -DB_Conn.java
        -DB_Test.java

_______________
Form.Viewer.gwt.xml
---
<module>
        <inherits name="com.google.gwt.user.User"/>
        <inherits name="com.google.gwt.user.theme.standard.Standard"/>
        <entry-point class="org.ifoc.form.client.FormViewer"/>
        <inherits name="com.extjs.gxt.ui.GXT"/>
        <inherits name="org.ifoc.form.FormViewer"/>
        <inherits name="org.ifoc.form.FormViewer"/>

        <!-- -->
        <source path='org.ifoc.form.client'/>
        <source path='org.ifoc.form.server'/>
        <source path='org.ifoc.form.shared'/>

</module>
________________
FormViewer.java
-----
package org.ifoc.form.client;


import org.ifoc.form.server.DB_Test;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class FormViewer implements EntryPoint {
        private TextBox txtbxFirst;
        private Button btnSave;
        private TextBox txtbxLast;
        public void onModuleLoad() {
                RootPanel rootPanel = RootPanel.get();

                VerticalPanel verticalPanel = new VerticalPanel();
                rootPanel.add(verticalPanel, 10, 10);
                verticalPanel.setSize("430px", "280px");

                FlexTable flexTable = new FlexTable();
                verticalPanel.add(flexTable);
                flexTable.setSize("210px", "20px");

                Label lblInsertAPerson = new Label("Insert a person");
                flexTable.setWidget(0, 1, lblInsertAPerson);

                Label lblFirst = new Label("First");
                flexTable.setWidget(1, 0, lblFirst);

                txtbxFirst = new TextBox();
                flexTable.setWidget(1, 1, txtbxFirst);

                Label lblLast = new Label("Last");
                flexTable.setWidget(2, 0, lblLast);

                txtbxLast = new TextBox();
                flexTable.setWidget(2, 1, txtbxLast);

                btnSave = new Button("Save");
                btnSave.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
/*ERROR*/               DB_Test rsTest = new DB_Test();
/*- org.ifoc.form.server.DB_Test can not be found in source packages.
Check the inheritance chain from your module;
 it may not be inheriting a required module or a module may not be
adding its source path entries properly.*/

                                rsTest.setData(txtbxFirst.getName(), 
txtbxLast.getName());
                        }
                });
                flexTable.setWidget(3, 1, btnSave);
        }
}

________________
DB_Test.java
------

package org.ifoc.form.server;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * I extend the DB_Conn abstract class, then I don't have to rewrite
code
 *
 * @author branflake2267
 *
 */
public class DB_Test extends DB_Conn {

        /**
         * constructor - nothing to do
         */
        public DB_Test() {
                // nothing to do
        }

        /**
         * get how many chapters are in a book
         *
         * @param book
         * @return
         */
        public int setData(String first, String last) {
                int resultado=0;
                String query = "INSERT INTO test (first, last) VALUES ('"+first
+"','"+last+"')";

                try {
                        Connection connection = getConn();
                        Statement select = connection.createStatement();
                        ResultSet result = select.executeQuery(query);

                        //rsSize = getResultSetSize(result); // size the array

                        // clean up
                        result.close();
                        connection.close();

                } catch (Exception e) {

                        System.err.println("Mysql Statement Error: " + query);
                        e.printStackTrace();
                        resultado = -1;
                }

                return resultado;
        }
}

____________________
.classpath
----
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/
org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/
>
        <classpathentry kind="lib" path="C:/Documents and Settings/jmsanchez/
Mis documentos/Java/gxt-2.2.1/gxt.jar"/>
        <classpathentry kind="con"
path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
        <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>

_____________________
.project
----
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
        <name>MyFirstConnection</name>
        <comment></comment>
        <projects>
        </projects>
        <buildSpec>
                <buildCommand>
                        <name>com.google.gdt.eclipse.designer.GWTBuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        <name>org.eclipse.jdt.core.javabuilder</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
                        <arguments>
                        </arguments>
                </buildCommand>
                <buildCommand>
                        
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
                        <arguments>
                        </arguments>
                </buildCommand>
        </buildSpec>
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>com.google.gdt.eclipse.designer.GWTNature</nature>
                <nature>com.google.gwt.eclipse.core.gwtNature</nature>
        </natures>
</projectDescription>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to