You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Anton Kurniawan (JIRA)" <ji...@apache.org> on 2016/05/18 09:36:12 UTC
[jira] [Comment Edited] (WICKET-6168) NULL Object Model in Radio
Group
[ https://issues.apache.org/jira/browse/WICKET-6168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15288685#comment-15288685 ]
Anton Kurniawan edited comment on WICKET-6168 at 5/18/16 9:35 AM:
------------------------------------------------------------------
The sample project in attachment
was (Author: antonkurniawan):
The sample project here..
> 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}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)