hi,
This is my Start.tml, i assume it's the same as Index.tml, but the first
onActivate is not called, any idea?
public class Start
{
Object onActivate(Object obj) {
System.out.println("index a");
return PageNotFound.class;
}
// use Start to load the home page so that dispatchers can be called
// if Home as the starting page, dispatchers will not be called at home
page point
public Class onActivate() {
return Home.class;
}
}
Filip S. Adamsen-2 wrote:
>
> Yes, it will. If the path isn't valid, Tapestry will pass it as the
> activation context to onActivate on your Index page.
>
> -Filip
>
> On 2008-08-14 15:16, Angelo Chen wrote:
>> Thanks for the fast response, but I can not quite understand, my setup is
>> like this:
>> I have a Start.tmp which in turn call the /Home page, based on what you
>> said, the
>> Start's onActive(Object obj) will be called if a invalid path is
>> supplied?
>>
>>
>> Filip S. Adamsen-2 wrote:
>>> Yeah, there is. At least I do that...
>>>
>>> I use onActivate on my Index page like this:
>>>
>>> Object onActivate(Object obj) {
>>> return ErrorNotFound.class;
>>> }
>>>
>>> Then, in my ErrorNotFound page, I set the HTTP Status Code to 404 to
>>> make the search engines happy:
>>>
>>> @Inject
>>> private RequestGlobals requestGlobals;
>>>
>>> public void setupRender() {
>>>
>>> requestGlobals.getHTTPServletResponse().setStatus(HttpServletResponse.SC_NOT_FOUND);
>>> }
>>>
>>> Works like a charm.
>>>
>>> -Filip
>>>
>>> On 2008-08-14 14:41, Angelo Chen wrote:
>>>> hi,
>>>>
>>>> how to define a default page that will be shown to the browser if a non
>>>> existing path is entered? example:
>>>> www.mydomain.com/page1, page1 does not exist, tomcat will display a
>>>> HTTP
>>>> Status 404 - /page1, any way to re-direct this in t5 app to a t5 page?
>>>> thanks.
>>>>
>>>> angelo
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/t5%3A-a-default-page-for-non-exist-path-tp18980767p18982691.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]