Re: RadioChoice - what's wrong?
Do you use Eclipse? There is a compiler warning that you can turn on (it should be on by default) that warns against this problem whenever you may inadvertently be "hiding" other variables. I suggest to everyone I teach that they turn it on (and perhaps even turn it up from warning to error), and of course, stop ignoring the little yellow squiggly lines :) On Sun, Oct 10, 2010 at 12:47 PM, Zeldor wrote: > > It does! Thanks a lot! I knew it was something stupid and trivial. Huh, but > it should not cause that still - I was defining TextFields in same way and > then again to add parameters and it went fine. > > On Sun, Oct 10, 2010 at 7:11 PM, Andrea Del Bene [via Apache Wicket] < > ml-node+2970427-965616561-152...@n4.nabble.com > > > > > wrote: > > > Hello Zeldor, > > > > I've red your code and it seems that you define variable rc two times: > > the first time as form private field and the second time just below > > between braces. When onSubmit method calls rc.getModelObject() it uses > > private field rc which was not initialized and so triggers a > > NullPointerException. Try to remove the second type definition > > "RadioChoice" and it should work. > > > -- Jeremy Thomerson http://www.wickettraining.com
Re: RadioChoice - what's wrong?
It does! Thanks a lot! I knew it was something stupid and trivial. Huh, but it should not cause that still - I was defining TextFields in same way and then again to add parameters and it went fine. On Sun, Oct 10, 2010 at 7:11 PM, Andrea Del Bene [via Apache Wicket] < ml-node+2970427-965616561-152...@n4.nabble.com > wrote: > Hello Zeldor, > > I've red your code and it seems that you define variable rc two times: > the first time as form private field and the second time just below > between braces. When onSubmit method calls rc.getModelObject() it uses > private field rc which was not initialized and so triggers a > NullPointerException. Try to remove the second type definition > "RadioChoice" and it should work. > > > public class Registration extends WebPage { > > public Registration() { > > add(new FeedbackPanel("errorMsg")); > >//New user registration form > > Form regForm = new > > Form("registrationForm",new Model()) { > > static final List NUMBERS = > > Arrays.asList(new String[] { "1", "2", "3" }); > > > > private RadioChoice rc; > > > > { > > RadioChoice rc = new > > RadioChoice("numberRadioChoice", new > > Model(""),NUMBERS).setSuffix(""); > > add(rc.setRequired(true)); > > } > > > > @Override > > public void onSubmit() { > > String _numbers = rc.getModelObject(); > > System.out.println(_numbers); > > } > > }; > > add(regForm); > > } > > } > > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2970427&i=0> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2970427&i=1> > > > > -- > View message @ > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2970427.html > To unsubscribe from RadioChoice - what's wrong?, click > here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2967576&code=cGdyb25raWV3aWN6QGdtYWlsLmNvbXwyOTY3NTc2fC0xMTUwMjA4NDM=>. > > > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2970465.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
Hello Zeldor, I've red your code and it seems that you define variable rc two times: the first time as form private field and the second time just below between braces. When onSubmit method calls rc.getModelObject() it uses private field rc which was not initialized and so triggers a NullPointerException. Try to remove the second type definition "RadioChoice" and it should work. public class Registration extends WebPage { public Registration() { add(new FeedbackPanel("errorMsg")); //New user registration form Form regForm = new Form("registrationForm",new Model()) { static final List NUMBERS = Arrays.asList(new String[] { "1", "2", "3" }); private RadioChoice rc; { RadioChoice rc = new RadioChoice("numberRadioChoice", new Model(""),NUMBERS).setSuffix(""); add(rc.setRequired(true)); } @Override public void onSubmit() { String _numbers = rc.getModelObject(); System.out.println(_numbers); } }; add(regForm); } } - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
So maybe someone could just show me working RadioChoice code with OnSubmit part? Just how to properly display it and grab data from it :) That should solve the problem, as I would compare and see what I'm doing wrong. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2970217.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
Sure, but I posted pretty much everything related to radiochoice :) So I am just not doing some obvious important steps for making RadioChoice work :) Code, with all non-related parts removed, looks like that: public class Registration extends WebPage { public Registration() { add(new FeedbackPanel("errorMsg")); //New user registration form Form regForm = new Form("registrationForm", new Model()) { static final List NUMBERS = Arrays.asList(new String[] { "1", "2", "3" }); private RadioChoice rc; { RadioChoice rc = new RadioChoice("numberRadioChoice", new Model(""), NUMBERS).setSuffix(""); add(rc.setRequired(true)); } @Override public void onSubmit() { String _numbers = rc.getModelObject(); System.out.println(_numbers); } }; add(regForm); } } On Fri, Oct 8, 2010 at 3:58 PM, Zilvinas Vilutis [via Apache Wicket] < ml-node+2968370-862341428-152...@n4.nabble.com > wrote: > Oh come on! no one will want to steal your non-working code! > > Use http://pastebin.com/ to show your code if you want someone's help ;) > > Žilvinas Vilutis > > Mobile: (+370) 652 38353 > E-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2968370&i=0> > > > > On Thu, Oct 7, 2010 at 11:35 PM, Zeldor <[hidden > email]<http://user/SendEmail.jtp?type=node&node=2968370&i=1>> > wrote: > > > > > 186 is System.out.println(_numbers); > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html<http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html?by-user=t> > > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2968370&i=2> > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2968370&i=3> > > > > > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2968370&i=4> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2968370&i=5> > > > nothing is impossible > > > -- > View message @ > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2968370.html > To unsubscribe from RadioChoice - what's wrong?, click > here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2967576&code=cGdyb25raWV3aWN6QGdtYWlsLmNvbXwyOTY3NTc2fC0xMTUwMjA4NDM=>. > > > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2968833.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
Oh come on! no one will want to steal your non-working code! Use http://pastebin.com/ to show your code if you want someone's help ;) Žilvinas Vilutis Mobile: (+370) 652 38353 E-mail: cika...@gmail.com On Thu, Oct 7, 2010 at 11:35 PM, Zeldor wrote: > > 186 is System.out.println(_numbers); > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
if number is null it will just print "null" -igor On Thu, Oct 7, 2010 at 11:49 PM, Zeldor wrote: > > Well, _numbers is null :) That's why I wonder what's wrong with getting the > ObjectModel - I must be doing smth wrong there :) > > On Fri, Oct 8, 2010 at 8:43 AM, Igor Vaynberg-2 [via Apache Wicket] < > ml-node+2967914-1064517663-152...@n4.nabble.com >> wrote: > >> in that case either your System or your System.out is null :) >> >> -igor >> >> On Thu, Oct 7, 2010 at 11:35 PM, Zeldor <[hidden >> email]<http://user/SendEmail.jtp?type=node&node=2967914&i=0>> >> wrote: >> >> > >> > 186 is System.out.println(_numbers); >> > -- >> > View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html<http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html?by-user=t> >> >> > Sent from the Users forum mailing list archive at Nabble.com. >> > >> > - >> > To unsubscribe, e-mail: [hidden >> > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=1> >> > For additional commands, e-mail: [hidden >> > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=2> >> > >> > >> >> - >> To unsubscribe, e-mail: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=2967914&i=3> >> For additional commands, e-mail: [hidden >> email]<http://user/SendEmail.jtp?type=node&node=2967914&i=4> >> >> >> >> -- >> View message @ >> http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967914.html >> To unsubscribe from RadioChoice - what's wrong?, click >> here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2967576&code=cGdyb25raWV3aWN6QGdtYWlsLmNvbXwyOTY3NTc2fC0xMTUwMjA4NDM=>. >> >> >> > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967920.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
Well, _numbers is null :) That's why I wonder what's wrong with getting the ObjectModel - I must be doing smth wrong there :) On Fri, Oct 8, 2010 at 8:43 AM, Igor Vaynberg-2 [via Apache Wicket] < ml-node+2967914-1064517663-152...@n4.nabble.com > wrote: > in that case either your System or your System.out is null :) > > -igor > > On Thu, Oct 7, 2010 at 11:35 PM, Zeldor <[hidden > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=0>> > wrote: > > > > > 186 is System.out.println(_numbers); > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html<http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html?by-user=t> > > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=1> > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=2> > > > > > > - > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=3> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2967914&i=4> > > > > -- > View message @ > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967914.html > To unsubscribe from RadioChoice - what's wrong?, click > here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2967576&code=cGdyb25raWV3aWN6QGdtYWlsLmNvbXwyOTY3NTc2fC0xMTUwMjA4NDM=>. > > > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967920.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
in that case either your System or your System.out is null :) -igor On Thu, Oct 7, 2010 at 11:35 PM, Zeldor wrote: > > 186 is System.out.println(_numbers); > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
186 is System.out.println(_numbers); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967903.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
On Thu, Oct 7, 2010 at 5:04 PM, Zeldor wrote: > Caused by: java.lang.NullPointerException >at com.spiritia.auth.Registration$1.onSubmit(Registration.java:186) > The error is obviously at Registration.java:186 - please show us that code if you can't figure it out. -- Jeremy Thomerson http://www.wickettraining.com
Re: RadioChoice - what's wrong?
I doubt anything else is needed, it throws NullPointerException at syso attempt. Rest of the form is working properly - I can of course post more code, but what would be needed? Stacktrace is pretty generic too... org.apache.wicket.RequestCycle logRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component [MarkupContainer [Component id = registrationForm]] threw an exception org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at component [MarkupContainer [Component id = registrationForm]] threw an exception ... ... ... Caused by: java.lang.reflect.InvocationTargetException at com.google.appengine.runtime.Request.process-a82d7b755ed3a9dd(Request.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:43) at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182) ... 50 more Caused by: java.lang.NullPointerException at com.spiritia.auth.Registration$1.onSubmit(Registration.java:186) at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1538) at org.apache.wicket.markup.html.form.Form.process(Form.java:934) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:896) ... 55 more On Thu, Oct 7, 2010 at 11:51 PM, Igor Vaynberg-2 [via Apache Wicket] < ml-node+2967607-1764587878-152...@n4.nabble.com > wrote: > cant help you without seeing more code and stack > > -igor > > On Thu, Oct 7, 2010 at 2:28 PM, Zeldor <[hidden > email]<http://user/SendEmail.jtp?type=node&node=2967607&i=0>> > wrote: > > > > > Hi, > > > > I am trying to get through with the very basics of Wicket - radiochoice. > But > > somehow I got stuck and all solutions I tried made my problems even > worse... > > So, what am I doing wrong? > > > > I have this code: > > > > static final List NUMBERS = Arrays.asList(new String[] { "1", > "2", > > "3" }); > > > > private RadioChoice rc; > > > >{ > >RadioChoice rc = new > RadioChoice("numberRadioChoice", new > > Model(""), NUMBERS).setSuffix(""); > >add(rc.setRequired(true)); > >} > > > > String _numbers = rc.getModelObject(); > > System.out.println(_numbers); > > > > When I submit the form I get: > > NullPointerException > > > > What am I doing wrong then? > > -- > > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967576.html<http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967576.html?by-user=t> > > Sent from the Users forum mailing list archive at Nabble.com. > > > > - > > To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2967607&i=1> > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=2967607&i=2> > > > > > > --------- > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2967607&i=3> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2967607&i=4> > > > > -- > View message @ > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967607.html > To unsubscribe from RadioChoice - what's wrong?, click > here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=2967576&code=cGdyb25raWV3aWN6QGdtYWlsLmNvbXwyOTY3NTc2fC0xMTUwMjA4NDM=>. > > > -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967624.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: RadioChoice - what's wrong?
cant help you without seeing more code and stack -igor On Thu, Oct 7, 2010 at 2:28 PM, Zeldor wrote: > > Hi, > > I am trying to get through with the very basics of Wicket - radiochoice. But > somehow I got stuck and all solutions I tried made my problems even worse... > So, what am I doing wrong? > > I have this code: > > static final List NUMBERS = Arrays.asList(new String[] { "1", "2", > "3" }); > > private RadioChoice rc; > > { > RadioChoice rc = new > RadioChoice("numberRadioChoice", new > Model(""), NUMBERS).setSuffix(""); > add(rc.setRequired(true)); > } > > String _numbers = rc.getModelObject(); > System.out.println(_numbers); > > When I submit the form I get: > NullPointerException > > What am I doing wrong then? > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967576.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RadioChoice - what's wrong?
Hi, I am trying to get through with the very basics of Wicket - radiochoice. But somehow I got stuck and all solutions I tried made my problems even worse... So, what am I doing wrong? I have this code: static final List NUMBERS = Arrays.asList(new String[] { "1", "2", "3" }); private RadioChoice rc; { RadioChoice rc = new RadioChoice("numberRadioChoice", new Model(""), NUMBERS).setSuffix(""); add(rc.setRequired(true)); } String _numbers = rc.getModelObject(); System.out.println(_numbers); When I submit the form I get: NullPointerException What am I doing wrong then? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/RadioChoice-what-s-wrong-tp2967576p2967576.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org