New to Weblocks - stuck in demo

65 views
Skip to first unread message

idurand

unread,
Oct 13, 2012, 12:19:51 PM10/13/12
to webl...@googlegroups.com
Hi,

I am new to Weblocks and trying to run the demo
http://trac.common-lisp.net/cl-weblocks/wiki/UserManual#BreakingtheIce

I have succeeded in seeing and using the weblocks-demo on
http://localhost:8080/weblocks-demo/

But I am stuck on the next step (changing something and seeing the result):

> (weblocks:defwebapp our-application :prefix "/")
> (defun init-user-session (comp)
    (setf (weblocks:composite-widgets comp)
          (list "Hello!")))

Now let's tell Weblocks to reset all sessions so it picks up the new application:

> (weblocks:reset-sessions)
Refresh the browser. Instead of the welcome page you should
now see the word "Hello!" printed on the screen.
----------------------------------------------------------------
The transcript is the following:
----------------------------------------------------------------
CL-USER> (defun init-user-session (comp)
(setf (weblocks:composite-widgets comp)
(list "Hello!")))
INIT-USER-SESSION
CL-USER> (weblocks:reset-sessions)
; No value
----------------------------------------------------------------
When refreshing the page, I see no change but
in the REPL I get the messages below.

I am really not understanding what I am doing.
But, I would appreciate any help that would make me move forward
my own web site.

Thanks in advance,
Irène




[2012-10-13 18:13:07 [INFO]] No session for session identifier '1:55838F08EC06B63F37D72B170DDD7D23' (User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0', IP: '127.0.0.1')
127.0.0.1 - [2012-10-13 18:13:07] "GET /weblocks-demo/ HTTP/1.1" 302 336 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/ HTTP/1.1" 302 336 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/ HTTP/1.1" 200 2413 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/stylesheets/layout.css HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/stylesheets/main.css HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/stylesheets/dialog.css HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/stylesheets/suggest.css HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/scripts/dialog.js HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/scripts/prototype.js HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/scripts/scriptaculous.js HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/scripts/shortcut.js HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"
127.0.0.1 - [2012-10-13 18:13:08] "GET /weblocks-demo/pub/scripts/weblocks.js HTTP/1.1" 304 - "http://localhost:8080/weblocks-demo/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"




idurand

unread,
Oct 20, 2012, 3:03:12 PM10/20/12
to webl...@googlegroups.com
Hi,

I am writing an answer to my own question as I have in the end succeeded in writing
"Hello" on the web page after
re-defining the init-user-session function in the weblocks-demo package
(instead of in the weblock or cl-user package).

I was deceived not to get any answer on this forum and I am a bit anxious for the future.

Is Weblocks already old fashioned? Is Weblocks the actual right choice to start
writing dynamic websites nowdays?
Are people using it and susceptible to help newbies?

Irène

Nandan Bagchee

unread,
Oct 21, 2012, 2:34:07 AM10/21/12
to webl...@googlegroups.com


> "Hello" on the web page after
> re-defining the init-user-session function in the weblocks-demo package
> (instead of in the weblock or cl-user package).

A humble suggestion.. Why don't you explain this in a separate newsgroup or blog post so that then the next newbie can get over this hump more easily?

> Is Weblocks already old fashioned? Is Weblocks the actual right choice to start
> writing dynamic websites nowdays?

I don't see where fashion comes into it. If it works for you, then use it. The right  choice is *your* choice.

Weblocks' dynamism is driven by the back end, which treats html and js merely as a compilation target. As such the approach was never in favor..

I will say that it is still one of the most productive frameworks around, especially for a single developer, surpassed perhaps by clj-noir. Interestingly both subscribe to a semantic markup approach which has never jibed well with the mainstream template div-itis approach favored by designers.

If you use it you will need to be ready to dig into the compiler at some point, especially if you use the grid, views, continuations and the quickform scaffolding.

If you use relatively simple features like sessions, build your widgets using html-template by Edi Weitz, and keep your js separate, you will get a productivity boost as well as have a simpler system, which is of critical importance when TSHTF.

In fact I recommend you take a look at the page driven SQL and html-template "building websites with LISP" tutorials out there so you can understand the background and advantages of Weblocks. In fact, you also need to be aware of the older Marco Baringer framework to appreciate the full context :)

> Are people using it and susceptible to help newbies?

I took some time out of a busy day to set up a fresh install just to try and answer your newbie question.

Unfortunately despite quickLISP, package installation failed for one notorious package :-(

The number of users is not high, but the websites using it in production are running just fine.

HTH,
nunb

> --
> You received this message because you are subscribed to the Google Groups "weblocks" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/weblocks/-/ACTqCSDjQCwJ.
>
> To post to this group, send email to webl...@googlegroups.com.
> To unsubscribe from this group, send email to weblocks+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/weblocks?hl=en.

Reply all
Reply to author
Forward
0 new messages