Problem with compound property model - values are not refreshing

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem with compound property model - values are not refreshing

ramlael
Below are my files

HTML
<input type="text" id="firstName" name="firstName" wicket:id="firstName"  value="" size="20" maxlength="10" /> 
 <input type="text" id="lastName" name="lastName" wicket:id="lastName"  value="" size="20" maxlength="20" />

Bean
Customer.java  - getters/setters for firstName and lastname

Component.java  - On URL getting the firstname and lastNames as page parameters
Customer customer = new Customer();
CompoundPropertyModel<Customer > compoundPropertyModel = new CompoundPropertyModel<Customer >(customer );
                final Form<?> addCardForm= new Form<CreditCard>("addCardForm",compoundPropertyModel);

customer.setFirstName(parameters.get("firstName").toString());
customer.setLastName(parameters.get("lastName").toString());

final TextField firstName = new TextField("firstName");
                final TextField lastName = new TextField("lastName");
addCardForm.add(firstName );
addCardForm.add(lastName);
add(addCardForm);


Here the Problems:

1) Once I load the file with URL : localhost:8080/addcard?firstName=ram&lastName=babu, the first name and last name displaying fine but if I change the firstName and lastName in same browser URL like localhost:8080/addcard?firstName=ravi&lastName=suri, the old values(ram,babu) only displaying in form fields(First Name and Last Name)

2) The form has AjaxSubmitLink- once I load the page with ram and babu, changed the first name ram to raj, and clicked submit button. if the page has any error the error message is writing to feed back panel but the First name is changing to old value that is ram.....

Is It problem with CompoundPropertyModel or cache probelm.. please suggest me the solution.