You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Edi <ed...@yahoo.com> on 2007/09/17 15:48:34 UTC

Regarding Wicket Session

Hello,

I am the newbie of wicket. I want to store some string in session. And i
want to get that session and display into another page. How?


in jsp,
I can set session like
session.setAttribute("session","session");

and easily get
session.getAttribute("session");

Using the above getAttribute method. In wicket How can I do this? 

Please explain.
-- 
View this message in context: http://www.nabble.com/Regarding-Wicket-Session-tf4466808.html#a12736184
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Regarding Wicket Session

Posted by Sam Hough <sa...@redspr.com>.
We have all been hacking away in JSP that, I for one, have forgotten how to
code properly. What is OO again? ;)


Martijn Dashorst wrote:
> 
> Why go through the session in the first place?
> 
> Why not:
> 
> public class Page1 extends WebPage {
>     public Page1() {
>         add(new Link("link") {
>             protected void onClick() {
>                 setResponsePage(new Page2("Some string"));
>             }
>         });
>      }
> }
> 
> public class Page2 extends WebPage {
>     public Page2(String text) {
>         add(new Label("label", text));
>     }
> }
> 
> 
> 
> On 9/17/07, Gerolf Seitz <ge...@gmail.com> wrote:
>> hi edi,
>>
>> typically, you would subclass from WebSession and provide your own
>> typesafe
>> getters and setters:
>>
>> public class MySession extends WebSession {
>>   private String myString;
>>
>>   public String getMyString() { return myString; }
>>   public void setMyString(String myString) { this.myString = myString; }
>> }
>>
>>
>> in your page you would do something like this:
>>
>> String myString = ((MySession)Session.get()).getMyString();
>>
>>
>> that's it...
>>
>> hth,
>>   gerolf
>>
>> On 9/17/07, Edi <ed...@yahoo.com> wrote:
>> >
>> >
>> > Hello,
>> >
>> > I am the newbie of wicket. I want to store some string in session. And
>> i
>> > want to get that session and display into another page. How?
>> >
>> >
>> > in jsp,
>> > I can set session like
>> > session.setAttribute("session","session");
>> >
>> > and easily get
>> > session.getAttribute("session");
>> >
>> > Using the above getAttribute method. In wicket How can I do this?
>> >
>> > Please explain.
>> > --
>> > View this message in context:
>> > http://www.nabble.com/Regarding-Wicket-Session-tf4466808.html#a12736184
>> > Sent from the Wicket - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
> 
> 
> -- 
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Regarding-Wicket-Session-tf4466808.html#a12752782
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: Regarding Wicket Session

Posted by Martijn Dashorst <ma...@gmail.com>.
Why go through the session in the first place?

Why not:

public class Page1 extends WebPage {
    public Page1() {
        add(new Link("link") {
            protected void onClick() {
                setResponsePage(new Page2("Some string"));
            }
        });
     }
}

public class Page2 extends WebPage {
    public Page2(String text) {
        add(new Label("label", text));
    }
}



On 9/17/07, Gerolf Seitz <ge...@gmail.com> wrote:
> hi edi,
>
> typically, you would subclass from WebSession and provide your own typesafe
> getters and setters:
>
> public class MySession extends WebSession {
>   private String myString;
>
>   public String getMyString() { return myString; }
>   public void setMyString(String myString) { this.myString = myString; }
> }
>
>
> in your page you would do something like this:
>
> String myString = ((MySession)Session.get()).getMyString();
>
>
> that's it...
>
> hth,
>   gerolf
>
> On 9/17/07, Edi <ed...@yahoo.com> wrote:
> >
> >
> > Hello,
> >
> > I am the newbie of wicket. I want to store some string in session. And i
> > want to get that session and display into another page. How?
> >
> >
> > in jsp,
> > I can set session like
> > session.setAttribute("session","session");
> >
> > and easily get
> > session.getAttribute("session");
> >
> > Using the above getAttribute method. In wicket How can I do this?
> >
> > Please explain.
> > --
> > View this message in context:
> > http://www.nabble.com/Regarding-Wicket-Session-tf4466808.html#a12736184
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/

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


Re: Regarding Wicket Session

Posted by Gerolf Seitz <ge...@gmail.com>.
hi edi,

typically, you would subclass from WebSession and provide your own typesafe
getters and setters:

public class MySession extends WebSession {
  private String myString;

  public String getMyString() { return myString; }
  public void setMyString(String myString) { this.myString = myString; }
}


in your page you would do something like this:

String myString = ((MySession)Session.get()).getMyString();


that's it...

hth,
  gerolf

On 9/17/07, Edi <ed...@yahoo.com> wrote:
>
>
> Hello,
>
> I am the newbie of wicket. I want to store some string in session. And i
> want to get that session and display into another page. How?
>
>
> in jsp,
> I can set session like
> session.setAttribute("session","session");
>
> and easily get
> session.getAttribute("session");
>
> Using the above getAttribute method. In wicket How can I do this?
>
> Please explain.
> --
> View this message in context:
> http://www.nabble.com/Regarding-Wicket-Session-tf4466808.html#a12736184
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>