T5.0.11: onActivate() called twice, more questions

View: New views
3 Messages — Rating Filter:   Alert me  

T5.0.11: onActivate() called twice, more questions

by Tomasz Dziurko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.
I read previous posts about problem with onActivate called twice, but
none of answers seems to suit my situation.

Here's the problem:

Abstract base page

public abstract class AbstractTopPage {

    private String context[];

    public abstract Object performActivation(String[] context);

    Object onActivate(EventContext eventContext) {
        context = new String[eventContext.getCount()];
        for (int i = 0; i < context.length; i++) {
            context[i] = eventContext.get(String.class, i);
        }

        return performActivation(context);

    }

}

and real page:

public class Start {

    @Override
    public Object performActivation(String[] context) {
        getLogger().info("TEST LOG");

        return null;
    }

    String onPassivate() {
        return "testmessage";
    }

}

and when I enter page http://localhost:8607/myApp/start/testmessage on
console I get:

11:59:25,219 [ INFO] Start - TEST LOG
11:59:25,919 [ INFO] Start - TEST LOG

so onActivate() is called two times. Anyone maybe could help?


Regards
--
Tomasz Dziurko

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


Re: T5.0.11: onActivate() called twice, more questions

by Tomasz Dziurko :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, I found solution, but I still would be grateful if someone could
put some light on this subject:

More investigation showed me that context.length is always +1 greater
than I should expect.
When I printed all elements from context while executing
http://localhost:8607/myApp/start/testmessage

11:59:25,219 [ INFO] Start - TEST LOG
thing in context=textmessage

11:59:25,219 [ INFO] Start - TEST LOG
thing in context=images
thing in context=pic.gif

After looking in my project for pic.gif it appeared that in my tml
file I have remains from default template.

Following line causes all the problems:
<img src="images/pic.gif" alt="default image" />

Now question: How is it possible that this situation might occur?

--
Tomasz Dziurko

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


Re: T5.0.11: onActivate() called twice, more questions

by Szemere Szemere :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Your images/pic.gif  is relative to the current page url (which includes
your context parameters), so will get caught as a page request by Tapestry.
You should probably use src="${asset:context:images/pic.gif}" instead.

Szemere

On Mon, May 12, 2008 at 11:23 AM, Tomasz Dziurko <tdziurko@...> wrote:

> [...]


> Following line causes all the problems:
> <img src="images/pic.gif" alt="default image" />
>
> Now question: How is it possible that this situation might occur?
>
> --
> Tomasz Dziurko
>