Reputation: 4406
I have a request scoped CDI manage bean(Also tried with jsf managed bean but the same problem!) :
@Named
@RequestScoped
public class myController{
private HashMap<String, MyModel> modelMap;
@PostConstruct
private void init() {
logModelMap = new HashMap<String, MyModel>();
logModelMap.put("CONSTANT_1", new MyModel());
logModelMap.put("CONSTANT_2", new MyModel());
logModelMap.put("CONSTANT_4", new MyModel());
}
public HashMap getModelMap() {
return logModelMap;
}
}
And MyModel class which is a simple pojo:
public class MyModel{
private String type = "";
private Date date;
//constructor, getter and setter methods
}
I have written a composit component using jsf and bind fields to textbox and calendar and I want to access fields inside hashmap and set some values:
#{myController.modelMap['CONSTANST_1'].type}
#{myController.modelMap['CONSTANST_1'].date}
#{myController.modelMap['CONSTANST_2'].type}
#{myController.modelMap['CONSTANST_2'].date}
#{myController.modelMap['CONSTANST_3'].type}
#{myController.modelMap['CONSTANST_3'].date}
but just the first two lines for constant_1 works and for other two constants, type and date are null ! I saw in firebug that values are sent to server properly but fields inside map are not set! By the way I'm using primefaces command button with ajax to send data to server.
Upvotes: 0
Views: 774
Reputation: 4406
Finally I got where the problem was. I had nested forms!!! One form that wraps my composite component and one form where I used my composite component!
Upvotes: 1