[Seaside] novice question: WATask vs WAComponent

Brian Brown rbb at techgame.net
Wed May 12 16:57:55 CEST 2004


On May 12, 2004, at 5:22 AM, Vadim Kolontsov wrote:

> Good morning,
>   probably it's a silly question, but anyway :) I'm just getting into 
> the Seaside ideology.

Not silly, I'm sure ;)

>
>  Is it OK to assume that WATask is a "Controller" and WAComponent is a 
> "View" in MVC terms? What is the main difference between them? As far 
> as I understood, I can think about WATask as "invisible WAComponent 
> without any pages", right? So when I should
>
>  For example, I'm implementing a classic "login form" component. It 
> should ask login/password (text form), it allows to remember it 
> between sessions (checkbox & cookies), it can show "incorrect login" 
> inside of form (without any intermediate pages), it allows to register 
> new user (using call to another component) and should be emeddable 
> into other components. I'm going to use a simple loop, which will run 
> until the user enters the correct login/password.
>
>  What is the best way to implement it? Should I use WATask or 
> WAComponent? A pointer to list archive would be OK (although I've read 
> almost all messages already :)
>

For this, I would use a WATask; you can think of it as an implicit 
look. The WATask>>go method is what you would override. All the lines 
of code in a "go" method get executed as a loop. Typically I'll do 
something like:

go
	self hasUser ifFalse: [
		self session user:  (self call: (MyLoginComp new ))].
	self call: (MyMainAppComp new).

As soon as they log in, they spend their session in MyMainAppComp. When 
the session times out, hasUser would return false and call the 
MyLoginComp.

Hope that helps!

Brian

> Thanks in advance,
> Vadim.
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside



More information about the Seaside mailing list