i have taken a very hard look @ the code believe i can't still figure it out.
please can i get @ least an example or clue of where or what you mean. thanks On Sun, May 11, 2008 at 5:54 PM, Jonathan Locke <[EMAIL PROTECTED]> wrote: > > > take a hard look. you never assigned to field model. > > > kengimel wrote: > > > > Hi, > > > > I am new to wicket and while trying out this snippet of code. > > > > > > public class GetQuoteSymbol extends WebPage { > > > > private Model model; > > > > public GetQuoteSymbol() { > > > > Form form = new Form("f") { > > > > protected void onSubmit() { > > String sym = (String) model.getObject(); > > int stockValue = sym.hashCode() % 100; > > QuoteResult quoteResult = new QuoteResult(stockValue); > > setResponsePage(quoteResult); > > } > > }; > > Model model = new Model("MSFT"); > > TextField symbol = new TextField("sym", model); > > > > form.add(symbol); > > add(form); > > > > } > > > > } > > > > > > > > <head> > > > > <title>GetQuoteSymbol</title> > > <link rel="stylesheet" type="text/css" href="style.css"/> > > </head> > > <body> > > <!-- --> > > > > <form wicket:id="f"> > > <input type="text" wicket:id="sym"> > > <input type="submit" value="Ok"> > > </form> > > </body> > > </html> > > > > > > public class QuoteResult extends WebPage { > > public QuoteResult(int stockValue) { > > > > add(new Label("v", Integer.toString(stockValue))); > > } > > > > } > > > > <html xmlns:wicket> > > <head> > > <meta http-equiv="Content-Type" content="text/html; > > charset=UTF-8"/> > > <title>QuoteResult</title> > > <link rel="stylesheet" type="text/css" href="style.css"/> > > </head> > > <body> > > <!-- --> > > The stock value is: 100. > > </body> > > </html> > > > > when i execute the code i encountered. > > > > this error:: > > > > WicketMessage: Method onFormSubmitted of interface > > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at > > component [MarkupContainer [Component id = f, page = > > myapp.stockquote.GetQuoteSymbol, path = 2:f.GetQuoteSymbol$1, isVisible = > > true, isVersioned = true]] threw an exception > > > > Root cause: > > > > java.lang.NullPointerException > > at myapp.stockquote.GetQuoteSymbol$1.onSubmit(GetQuoteSymbol.java:26) > > at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1328) > > at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:776) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183) > > at > > > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > > at > > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91) > > at > > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1166) > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331) > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) > > at > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363) > > at > > > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) > > at > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > at > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) > > at > > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) > > at > > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) > > at > > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) > > at > > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) > > at > > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) > > at > > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) > > at > > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) > > at > > > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) > > at > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) > > at java.lang.Thread.run(Thread.java:619) > > > > Complete stack: > > > > org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of > > interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted > > at component [MarkupContainer [Component id = f, page = > > myapp.stockquote.GetQuoteSymbol, path = 2:f.GetQuoteSymbol$1, isVisible = > > true, isVersioned = true]] threw an exception > > at > > > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:194) > > at > > > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > > at > > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91) > > at > > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1166) > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331) > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) > > at > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363) > > > > java.lang.reflect.InvocationTargetException > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at java.lang.reflect.Method.invoke(Method.java:597) > > at > > > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:183) > > at > > > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > > at > > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91) > > at > > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1166) > > at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) > > at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331) > > at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) > > at > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363) > > > > can someone tell me what might be wrong..... thanks > > > > -- > View this message in context: > http://www.nabble.com/Problem-with-Textfield-tp17170575p17170604.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Okpala Ikenna N. Jr.