tags:

views:

200

answers:

2

before call protected void onSubmit() { , what method is called by wicket? my texfield string loginName is null ,but if i close the browser and restart the browser and view the page, i able to see the textfield string loginame is populated with value i entered in the textfield.

>       <td class="label"><wicket:message
> key="login.loginName"/></td>
>                         <td colspan="2"><input
> wicket:id="loginName" size="35"/></td>
+1  A: 

Is it possible that the textfield is populated not by Wicket, but by your web browser itself? I'm talking about the universally implemented feature of saving submitted values (username/passwords in particular/quite aggressively from what I remember) from forms (autocomplete I suppose?).

To check, view the source of your generated page, and see if the default value is in there. If it is in there, then it is Wicket that is pre-filling the field. If it is not in there, then it would most likely be your web browser that is populating the field when you aren't looking. Somewhere in your web browser's preferences is a way to clear out and/or disable its internal form-pre-filling feature.

Also, some browsers support an autocomplete="off" attribute on text fields, which might prevent the browser from pre-filling the field.

Adam Batkin
good thinking. but i dont think is the problem
cometta
+1  A: 

If it isn't your browser populating the field, then it's most likely that the Model backing the Textfield has the value. E.g. if you populate your Form with a User Object, be sure that User.getLoginName() returns null - otherwise the textfield will always be populated with the content of the object. If this sounds complicated or new to you, be sure to understand the concept of working with wicket models - that's one of the crucial parts of the framework.

msparer