You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gerald Fernando <ge...@gmail.com> on 2009/08/28 07:17:08 UTC

How to use session

Hello Friends,
I have page in which textField and button .
when submit a form (onClick )  i need to call same page and pass argument to
that page.
so that page will take argument from session variable.How to store and how
to get that value
*for loading same page*,Shall i call the page using *setResponsePage*
and *shall
i get the argument* for that page from session variable?
how can i achieve this.

-- 
Thanks&regards,
Gerald A

Re: How to use session

Posted by Gerald Fernando <ge...@gmail.com>.
 Thomerson Thank You very much.
I have done successfully from your idea.
Thanks&Regards,
Gerald A

On Fri, Aug 28, 2009 at 9:13 PM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> So, declare the constructor that you need to pass in the variable.
> It's okay to have multiple constructors.  You're going to have to have
> some way of constructing the object and giving it the search term
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Fri, Aug 28, 2009 at 2:58 AM, Gerald
>  Fernando<ge...@gmail.com> wrote:
> > hi Thomerson,
> >
> > Actually my page(RSSPage)
> > this call sectorPanel class extends Panel like
> >
> > public class RSSPage extends WebPage {
> >
> >    public RSSPage(){
> >        add(new sectorGrid("sector");
> >    }
> >
> > }
> >
> > public class sectorGrid extends Panel {
> >    private String param=null;
> >    private TextField input;
> >    private Form form;
> >    private Button button;
> >    private ListView people;
> >
> >    public sectorGrid(String id,String arg)
> >      {
> >        super(id);
> >        param = arg;
> >
> >        input = new TextField("inputkey",new Model(""));
> >        button = new Button("search");
> >
> >                Form form = new Form("form") {
> >                    public void onSubmit() {
> >                         String key   = (String)input.getModelObject();
> >
> >                            //System.out.println("Key : "+key);
> >
> >                            setResponsePage(RSSPage.class);-->*here Iwant
> to
> > pass key to this(RSSPage) class*
> >
> >                        }
> >
> >                    };
> >
> >        form.add(input);
> >        form.add(button);
> >        add(form);
> >
> >
> >           RSSReader p = new RSSReader();
> >              add(new ListView("people", p.writeNews(param))
> >                {
> >                @Override protected void populateItem(ListItem item)
> >                        {
> >                        RSSReader person =
> (RSSReader)item.getModelObject();
> >                        item.add(new ExternalLink("link",person.link,
> > person.title));
> >                        item.add(new Label("description",
> > person.description));
> >                        }
> >                }
> >
> >           );
> >
> >    }
> > }
> >
> > But in your code you passed argument to the calling class but in my
> RSSPage
> > class i didnt
> > declare contructor to receive variable.
> > So your code is suitable for this case
> > Give me quick Reply
> >
> > Thanks&Regards,
> > Gerald A
> >
> >
> >
> >
> > On Fri, Aug 28, 2009 at 10:49 AM, Jeremy Thomerson <
> > jeremy@wickettraining.com> wrote:
> >
> >> Why put the variable in the session at all?  Do this in your onSubmit:
> >>
> >> onSubmit() {
> >> setResponsePage(new SomePage(this.someVariable));
> >> }
> >>
> >> --
> >> Jeremy Thomerson
> >> http://www.wickettraining.com
> >>
> >>
> >>
> >>
> >> On Fri, Aug 28, 2009 at 12:17 AM, Gerald
> >> Fernando<ge...@gmail.com> wrote:
> >> > Hello Friends,
> >> > I have page in which textField and button .
> >> > when submit a form (onClick )  i need to call same page and pass
> argument
> >> to
> >> > that page.
> >> > so that page will take argument from session variable.How to store and
> >> how
> >> > to get that value
> >> > *for loading same page*,Shall i call the page using *setResponsePage*
> >> > and *shall
> >> > i get the argument* for that page from session variable?
> >> > how can i achieve this.
> >> >
> >> > --
> >> > Thanks&regards,
> >> > Gerald A
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > --
> > Thanks&regards,
> > Gerald A
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thanks&regards,
Gerald A

Re: How to use session

Posted by Jeremy Thomerson <je...@wickettraining.com>.
So, declare the constructor that you need to pass in the variable.
It's okay to have multiple constructors.  You're going to have to have
some way of constructing the object and giving it the search term

--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, Aug 28, 2009 at 2:58 AM, Gerald
Fernando<ge...@gmail.com> wrote:
> hi Thomerson,
>
> Actually my page(RSSPage)
> this call sectorPanel class extends Panel like
>
> public class RSSPage extends WebPage {
>
>    public RSSPage(){
>        add(new sectorGrid("sector");
>    }
>
> }
>
> public class sectorGrid extends Panel {
>    private String param=null;
>    private TextField input;
>    private Form form;
>    private Button button;
>    private ListView people;
>
>    public sectorGrid(String id,String arg)
>      {
>        super(id);
>        param = arg;
>
>        input = new TextField("inputkey",new Model(""));
>        button = new Button("search");
>
>                Form form = new Form("form") {
>                    public void onSubmit() {
>                         String key   = (String)input.getModelObject();
>
>                            //System.out.println("Key : "+key);
>
>                            setResponsePage(RSSPage.class);-->*here Iwant to
> pass key to this(RSSPage) class*
>
>                        }
>
>                    };
>
>        form.add(input);
>        form.add(button);
>        add(form);
>
>
>           RSSReader p = new RSSReader();
>              add(new ListView("people", p.writeNews(param))
>                {
>                @Override protected void populateItem(ListItem item)
>                        {
>                        RSSReader person = (RSSReader)item.getModelObject();
>                        item.add(new ExternalLink("link",person.link,
> person.title));
>                        item.add(new Label("description",
> person.description));
>                        }
>                }
>
>           );
>
>    }
> }
>
> But in your code you passed argument to the calling class but in my RSSPage
> class i didnt
> declare contructor to receive variable.
> So your code is suitable for this case
> Give me quick Reply
>
> Thanks&Regards,
> Gerald A
>
>
>
>
> On Fri, Aug 28, 2009 at 10:49 AM, Jeremy Thomerson <
> jeremy@wickettraining.com> wrote:
>
>> Why put the variable in the session at all?  Do this in your onSubmit:
>>
>> onSubmit() {
>> setResponsePage(new SomePage(this.someVariable));
>> }
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Fri, Aug 28, 2009 at 12:17 AM, Gerald
>> Fernando<ge...@gmail.com> wrote:
>> > Hello Friends,
>> > I have page in which textField and button .
>> > when submit a form (onClick )  i need to call same page and pass argument
>> to
>> > that page.
>> > so that page will take argument from session variable.How to store and
>> how
>> > to get that value
>> > *for loading same page*,Shall i call the page using *setResponsePage*
>> > and *shall
>> > i get the argument* for that page from session variable?
>> > how can i achieve this.
>> >
>> > --
>> > Thanks&regards,
>> > Gerald A
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Thanks&regards,
> Gerald A
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to use session

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Why put the variable in the session at all?  Do this in your onSubmit:

onSubmit() {
setResponsePage(new SomePage(this.someVariable));
}

--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, Aug 28, 2009 at 12:17 AM, Gerald
Fernando<ge...@gmail.com> wrote:
> Hello Friends,
> I have page in which textField and button .
> when submit a form (onClick )  i need to call same page and pass argument to
> that page.
> so that page will take argument from session variable.How to store and how
> to get that value
> *for loading same page*,Shall i call the page using *setResponsePage*
> and *shall
> i get the argument* for that page from session variable?
> how can i achieve this.
>
> --
> Thanks&regards,
> Gerald A
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org