I am begginer please lettle explain On Thu, Feb 17, 2011 at 3:56 PM, Martin Grigorov <mgrigo...@apache.org>wrote:
> public void onEvent() { > > Object obj = service.getObject(); > OtherPage otherPage = new OtherPage(obj); > setResponsePage(otherPage); > } > > On Thu, Feb 17, 2011 at 12:51 PM, Jehan <jeeha...@gmail.com> wrote: > > > I want to pass Object of a class to other page. > > > > On Thu, Feb 17, 2011 at 3:37 PM, Bas Gooren <b...@iswd.nl> wrote: > > > > > Jehan, > > > > > > It depends on the URL you want to show to the user. If you want a > > > bookmarkable url, you'll need to use page parameters. If the url > doesn't > > > matter to you, you can simply pass in parameters to the constructor of > > the > > > other page, and then call setResponsePage( <page instance variable> ). > > > > > > Bas > > > > > > Op 17-2-2011 11:32, Jehan schreef: > > > > > > Thanks Bas Gooren, > > >> > > >> Passing values other pages using PageParameter is like Query String. > > >> > > >> What are other ways in wicket of passing values from one page to > other. > > >> > > >> On Thu, Feb 17, 2011 at 3:08 PM, Ernesto Reinaldo Barreiro< > > >> reier...@gmail.com> wrote: > > >> > > >> I think the problem is there is no model backing your text field. > > >>> Maybe you might want to read [1] > > >>> > > >>> Ernesto > > >>> > > >>> 1-https://cwiki.apache.org/WICKET/working-with-wicket-models.html > > >>> > > >>> On Thu, Feb 17, 2011 at 10:56 AM, Jehan<jeeha...@gmail.com> wrote: > > >>> > > >>>> -------------------------------------HelloWorld.Html > > >>>> > > >>>> <form wicket:id="*myform"*> > > >>>> <input type=*"text"* wicket:id=*"atext"* value=*"Default value"* /> > > >>>> <input type=*"submit"* wicket:id=*"okbutton"* value=*"OK"* /> > > >>>> </form> > > >>>> > > >>>> ---------------------------------------HelloWorld.java > > >>>> > > >>>> Following is code in constructor----------------------- HelloWorld( > > >>>> PageParameters > > >>>> pars) > > >>>> > > >>>> *Form* frm = *new* *Form("myform") > > >>>> * > > >>>> > > >>>> { *protected* *void* onSubmit() { info("Form submitted"); } }; > > >>>> > > >>>> txtName = *new* TextField<String>("atext"); > > >>>> > > >>>> frm.add(txtName); > > >>>> > > >>>> Button okButton = *new* *Button("okbutton") > > >>>> * > > >>>> > > >>>> { > > >>>> > > >>>> *public* *void* onSubmit() { > > >>>> > > >>>> pars.add("aname", txtName.getInput()); > > >>>> > > >>>> setResponsePage(thetest.*class*,pars); > > >>>> > > >>>> } > > >>>> > > >>>> }; > > >>>> > > >>>> frm.add(okButton); > > >>>> > > >>>> add(frm); > > >>>> > > >>>> ---------------------------- > > >>>> > > >>>> when I click OK button I am getting following error > > >>>> > > >>>> > > >>>> Unexpected RuntimeException > > >>>> > > >>>> WicketMessage: Method onFormSubmitted of interface > > >>>> org.apache.wicket.markup.html.form.IFormSubmitListener targeted at > > >>>> component [MarkupContainer [Component id = myform]] threw an > exception > > >>>> > > >>>> Root cause: > > >>>> > > >>>> java.lang.IllegalStateException: Attempt to set model object on null > > >>>> model of component: myform:atext > > >>>> at > > >>>> > > >>> > org.apache.wicket.Component.setDefaultModelObject(Component.java:3105) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.FormComponent.updateModel(FormComponent.java:1168) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component(Form.java:229) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:514) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrderHelper(FormComponent.java:493) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrder(FormComponent.java:465) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModels(Form.java:2110) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.java:2078) > > >>> > > >>>> at > org.apache.wicket.markup.html.form.Form.process(Form.java:1028) > > >>>> at > org.apache.wicket.markup.html.form.Form.process(Form.java:955) > > >>>> at > > >>>> > > >>> > org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920) > > >>> > > >>>> at java.lang.reflect.Method.invoke(Method.java:597) > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250) > > >>> > > >>>> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > > >>>> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) > > >>>> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > > >>>> at > > >>>> > > >>> > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) > > >>> > > >>>> at > > >>>> > > >>> > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) > > >>> > > >>>> at > > >>>> > > >>> > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) > > >>> > > >>>> at > > >>>> > > >>> > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) > > >>> > > >>>> at > > >>>> > > >>> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) > > >>> > > >>>> at > > >>>> > > >>> > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > > >>> > > >>>> at org.mortbay.jetty.Server.handle(Server.java:326) > > >>>> at > > >>>> > > >>> > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) > > >>> > > >>>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) > > >>>> at > > org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) > > >>>> at > > org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) > > >>> > > >>>> Complete stack: > > >>>> > > >>>> org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of > > >>>> interface org.apache.wicket.markup.html.form.IFormSubmitListener > > >>>> targeted at component [MarkupContainer [Component id = myform]] > threw > > >>>> an exception > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250) > > >>> > > >>>> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > > >>>> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) > > >>>> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > > >>>> at > > >>>> > > >>> > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486) > > >>> > > >>>> 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:182) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) > > >>> > > >>>> at > > >>>> > > >>> > > >>> > > > org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250) > > >>> > > >>>> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) > > >>>> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) > > >>>> at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) > > >>>> at > > >>>> > > >>> > > org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486) > > >>> --------------------------------------------------------------------- > > >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > >>> For additional commands, e-mail: users-h...@wicket.apache.org > > >>> > > >>> > > >>> > > >