[Bese-devel] problem with actions

Carlos Ungil carlos.ungil at bluewin.ch
Mon Aug 1 22:48:32 UTC 2005


Hello,

I don't understand why the code below is not working. Well, I bet the 
code is fine and the problem is only in my expectations. I hope this 
will be obvious to someone who can give me a hint.

The test-list component (/test/index.ucw) shows a list of ten items 
0..9, and clicking on one of them won't show that number, as I would 
like, but all of them display the number 10. I think this is because 10 
is the value the of i variable after the loop, and somehow this is the 
only value used by the system.

How can I make the display-number actions see the different values of 
the variable, and not just the final one? Maybe my approach is 
completely wrong. In that case, what  is the right construct to get 
something like this? What I really want to do is to show a list of 
objects, displaying the object when clicking on link.

Thanks [for any help on this, and for making the ucw code available in 
the first place!],

Carlos

-=-=-=-=-=-=-=-=-=-

(in-package :it.bese.ucw-user)

(defvar *test-application*
   (make-instance 'cookie-session-application
                  :url-prefix "/test/"))

(register-application *default-server* *test-application*)

(defentry-point "index.ucw" (:application *test-application*) ()
   (call 'test-list))

(defcomponent test-list (simple-window-component) ())

(defcomponent test-display (simple-window-component)
   ((number :accessor number :initarg :number)))

(defaction display-number ((c test-list) number)
   (call 'test-display :number number))

(defmethod render-on ((res response) (app test-list))
   (<:ul (loop for i from 0 below 10
	      do (<:li (<ucw:a :action (display-number app i)
			       (<:as-html i))))))

(defmethod render-on ((res response) (app test-display))
   (<:as-html (number app)))




More information about the bese-devel mailing list