There are radio buttons whose choices change depending on the parameters. When I select and post any item, ** "j_idt39: Validation error: Value is not valid" ** occurs. It does not occur in a local or single instance environment.
The project requirements did not use sticky sessions and were randomly assigned to the server for each communication. As a result, the beans were replicated in the session, and there was a list of radio button choices with no initial value (null) in it. Unfortunately when I posted, I was getting a validation error when the list hit a null bean.
XHTML
<form jsf:id="form" jsf:prependId="false">
<h:selectOneRadio name="choiceName" value="#{choiceBean.choiceName}" styleClass="radio_list">
<f:selectItems value="#{choiceBean.choiceList}" var="prize" itemLabel="#{item.labelName}" itemValue="#{item}" />
</h:selectOneRadio>
<button jsf:action="#{pageControlBean.toConfirm()}" class="btn_orange">
next
</button>
<span jsfc="h:messages" class="form_error_text" />
</form>
Bean
@Named
@SessionScoped
public class ChoiceBean implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Getter @Setter
private ChoiceType choiceName;
@Getter @Setter
private List<ChoiceType> choiceList;
}
Enum
public enum ChoiceType {
TYPE1("Type 1", 0),
TYPE2("Type 2", 1),
TYPE3("Type 3", 2);
@Getter
private final String labelName;
@Getter
private final int index;
private ChoiceType(String labelName, int index) {
this.labelName = labelName;
this.index = index;
}
}
Set the initial value in the constructor.
Bean
@Named
@SessionScoped
public class ChoiceBean implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@Getter
@Setter
private PrizeType choiceName;
@Getter
@Setter
private List<ChoiceType> choiceList;
/**
* Constructor
*Not Null variable initial value setting
*/
public ChoiceBean() {
choiceList = new ArrayList<>();
choiceList.add(ChoiceType.TYPE1);
choiceList.add(ChoiceType.TYPE2);
choiceList.add(ChoiceType.TYPE3);
}
}
Finally, I investigated with an IDE (such as the paid version Intellij) that can see the contents of the session and found a copy of the bean. It seems that you can see it in NetBeans with JavaEE.
Recommended Posts