[Seaside] What's the difference and why??
Philippe Marschall
philippe.marschall at gmail.com
Sun Feb 26 18:26:53 UTC 2006
> Yes, it seemed to work for me.. Now, whether or not it's right is
> certainly up for discussion..
> I'm still both a Seaside and Smalltalk newbie (as I mentioned before),
> so if I'm doing something
> wrong, please let me know.. Any ideas on how to write such a set of
> code and where to put
> it (or not to) would be greatly appreciated!
Well then, let's go.
> html listItem: [html anchorWithAction: [self renderMain: html] text: 'Home'.].
What is exactly happening here:
- you render a list item
- inside that list item you render anchor with text 'Home' <a
href="...">Home</a>
so this will look about like this:
<li><a href="...">Home</a></li>
now when someone clicks that link, #renderMain: get's sent to self
with the now no longer valid html renderer as argument, this argument
is thus completetly useless. I don't know what happens in
#renderMain:, but you obviously can't do rendering so calling it
#renderXXX is a not a good idea.
Depending on what you want to achieve, I see two ways to do it.
First.
html listItem: [
html anchorWithAction: [ self homeClicked ] do: [ self renderMain: html ] ]
This makes a list item with a anchor inside, inside that anchor is
whatever you render in #renderMain:. When someone clicks the link,
#homeClicked gets sent to the component.
or
html listItem: [html anchorWithAction: [ self homeClicked ] text: 'Home' ].
This makes a list item with a anchor inside, inside that anchor is
just 'Home' like in your current code. When someone clicks the link,
#homeClicked gets sent to the component.
> Ok I think.. I don't have much of a Java background -- mostly C/C++..
> I'm not sure I follow
> completely here. Ideally, what I'm looking to do is have a method in my
> WATask derived
> class so that it can pass a set of generated page links to each "task"
> (e.g. update contact info,
> main page, generate reports, etc.. These links will be common to each
> page and I'd rather
> not embed them into each class that does the actions I want (thereby
> duplicating code)
Now I'm not sure I follow completely ;)
With links you don't mean links outside of your seaside application,
do you? Can you somehow implement the behavior in a superclass of all
your components that do these "tasks"? Or put it into a real WATask
and call it from your components? Or put it into an a component that
is around the inner components?
Philippe
More information about the Seaside
mailing list