Hi!

Actually i've some problem with my GWT project. I have some textfield
and a button. Clickin the button, a method starts and write the string
into a mysql database with a servlet. It works wonderfull.
Now i wanted some additional features in this method. I want to search
the database first, for the string, and if it finds a equal string in
my database it should return a error message and NOT put the new
string into the database.
But when i add this new async call into the same method nothing works
anymore. I cant get the string checked neither the string gets written
into database.
My code:

This is the method, i start when the button is clicked:
void checkForm () {

                // first i check if the Async Classes are null, i instantiate 
them
as "null" in the beginning
                if (sbmtuser == null) {
                        sbmtuser = GWT.create(SubmitUserService.class);

                }
                if (getuser == null) {
                        getuser = GWT.create(GetUserService.class);
                }
                // here i check for the user in the database, user is the string
                AsyncCallback<String> callbackFindUser = new
AsyncCallback<String>() {
                        public void onFailure(Throwable caught) {
                                //check error
                        }
                        public void onSuccess(String svar) {
                                doubleuser = svar;
                        }
                };
                getuser.getDefinedUser(vorname.getValue(), callbackFindUser);

                if (doubleuser == "user found") {
                        message2.setText("user allreay exists");
                        message2.setVisible(true);
                        return;
                }


                AsyncCallback<String> callback = new AsyncCallback<String>() {
                        public void onFailure(Throwable caught) {
                                // error
                                }
                        public void onSuccess(String result) {


                                message.setText("success?"+result);
                                message.setVisible(true);
                                message2.setVisible(false);

                        }


                };
                sbmtuser.setUser(user, callback);

        }

As you can see, my callbacks return me a string. This string just
holds exception messages or messages like "successfully user added". I
think there is pretty much everything correct. I tested this code out
with just the second part, with only one "call". It works. It tells me
"success? user added" and the database is filled with the new user
string.
But then i add this first "check" and then everything collapse.
Nothing work anymore. I think there seems to be an error in my .xml
file.
First i add this string to the .gwt.xml file:
      <servlet path="/submituser"
class="extGWTformular.server.SubmitUserServiceImpl" />

It works! Now i want to add my new call class. So i add another
string:
      <servlet path="/submituser"
class="extGWTformular.server.SubmitUserServiceImpl" />
      <servlet path="/getuser"
class="extGWTformular.server.GetUserServiceImpl" />

And the web.xml for my tomcat looks similar.
First it looks like this:
<servlet>
  <servlet-name>SubmitUserService</servlet-name>
  <servlet-class>extGWTformular.server.SubmitUserServiceImpl</servlet-
class>
</servlet>
<servlet-mapping>
  <servlet-name>SubmitUserService</servlet-name>
  <url-pattern>/submituser</url-pattern>
</servlet-mapping>

With this code i upload it as a .war file to my tomcat and everything
is just fine.
Then i add the new method and the web.xml looks like this:
<servlet>
  <servlet-name>SubmitUserService</servlet-name>
  <servlet-class>extGWTformular.server.SubmitUserServiceImpl</servlet-
class>

  <servlet-name>GetUserService</servlet-name>
  <servlet-class>extGWTformular.server.GetUserServiceImpl</servlet-
class>
</servlet>
<servlet-mapping>
  <servlet-name>SubmitUserService</servlet-name>
  <url-pattern>/submituser</url-pattern>

  <<servlet-name>GetUserService</servlet-name>
  <url-pattern>/getuser</url-pattern>
</servlet-mapping>

Now nothing works anymore.

So where could be my error? As i mentioned a couple of times: it works
fine with just one call. So there is no error with missing ";" or
something. If u find in the code above some trivial errors like
missing ";" or not instatiated variables or something, it is because i
dont wanted to add my whole code inside here. The code works just
fine, when its just one call to some async class and servlet. The
error seems to be somewhere in the web.xml ...
Any help??
--~--~---------~--~----~------------~-------~--~----~
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