[
https://issues.apache.org/jira/browse/WICKET-6168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sven Meier resolved WICKET-6168.
--------------------------------
Resolution: Invalid
I cannot open the attached project.
If you don't add any Radio components to the RadioGroup, it will set the model
object to null on submit.
> NULL Object Model in Radio Group
> --------------------------------
>
> Key: WICKET-6168
> URL: https://issues.apache.org/jira/browse/WICKET-6168
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 7.3.0
> Environment: {code}
> # apache-tomcat-8.0.35
> # java 8
> {code}
> Reporter: Anton Kurniawan
> Attachments: myproject.zip
>
>
> Creating project use (http://wicket.apache.org/start/quickstart.html):
> {code}
> mvn archetype:generate -DarchetypeGroupId=org.apache.wicket
> -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=7.3.0
> -DgroupId=com.mycompany -DartifactId=myproject
> -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false
> {code}
> Change java version:
> {code}
> :
> <plugin>
> :
> <plugin>
> <inherited>true</inherited>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>3.1</version>
> <configuration>
> *<source>1.8</source>*
> *<target>1.8</target>*
> <encoding>UTF-8</encoding>
> :
> {code}
> Add a field:
> {code}
> private final IModel<String> stringModel = new Model<>("AAAAAAAAAAAAAAAAA");
> {code}
> Add some codes in constructor {{Home.java}}:
> {code}
> /*RADIO GROUP TEST*/
> callMe();
> final Form<Void> form = new Form<>("form");
> form.add(new RadioGroup<>("stringRg", stringModel));
> form.add(new AjaxButton("btnTest") {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
> super.onSubmit(target, form);
> callMe();
> }
> });
> add(form);
> /*END OF RADIO GROUP TEST*/
> {code}
> And in HTML:
> {code}
> <!-- TEST RADIO GROUP -->
> <form wicket:id="form">
> <div wicket:id="stringRg"></div>
> <button wicket:id="btnTest">TEST</button>
> </form>
> <!-- END OF TEST RADIO GROUP -->
> {code}
> Add mymethod in {{Home.java}}:
> {code}
> private void callMe() {
> System.out.println(String.format("String object: %s",
> stringModel.getObject()));
> }
> {code}
> The output:
> {code}
> String object: AAAAAAAAAAAAAAAAA --> called by constructor
> String object: null --> called by {button test}}
> {code}
> tag : [~ceefour] [[email protected]]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)