You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by kpub <kp...@actcom.net.il> on 2003/09/05 06:26:35 UTC

Some beginner questions.

Hi,

1. What are the benefits of using global/visit over subclassing 
application/engine.
2. If I use global/visit:  how can I access the corresponding 
application/engine from the
    global/visit context without subclassing the application/engine.
3. I'd like to get localized strings from  <my application>.propertise 
file.
    Do I have to implemnet this myself ?

Thanks
Yaniv.


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Some beginner questions.

Posted by Harish Krishnaswamy <hk...@comcast.net>.

kpub wrote:

> Hi,
>
> Thanks for the reply but you didn't answered my questions (maybe it's 
> my bad english?). I'm adding inline remarks.
>
> Harish Krishnaswamy wrote:
>
>>
>> kpub wrote:
>>
>>> Hi,
>>>
>>> 1. What are the benefits of using global/visit over subclassing 
>>> application/engine. 
>>
>>
>>
>> You may find my explanation of these objects at 
>> http://myworkspace.sourceforge.net/Illustrating_Tapestry.html. Scroll 
>> down to the "Framework - a flyby" section. 
>
>
> This section dosen't answer my question why can't I subclass 
> application/engine insted of using
> global/visit it's just explain that such objects exist.
>
> The part about the visit I now understand. By creating the visit 
> pget.getVisit() we are triggering creating
> of session+visit.
>
> As for the global object I'm still wondering why? 

Separation of Concern is probably the answer you are looking for.

>
>
>>
>>
>>>
>>> 2. If I use global/visit:  how can I access the corresponding 
>>> application/engine from the
>>>    global/visit context without subclassing the application/engine. 
>>
>>
>>
>> You may access the servlet and the engine from the page class by 
>> calling getRequestCycle().getRequestContext().getServlet() and 
>> getEngine() respectively. 
>
>
> I was asking about getting the application/engine from the 
> global/visit context, like from the
> global/visit constructor. 

The Global and Visit objects are not provided by the framework you 
specify an object as Global or Visit and the framework just creates them 
at the appropriate time, so it is entirely up to you to manage these 
objects as far as information is concerned. In case you did not already 
know, the Global is normally used for sharing data across sesssions like 
DataSource or EJB Home references.

>
>
>>
>>
>>>
>>> 3. I'd like to get localized strings from  <my 
>>> application>.propertise file.
>>>    Do I have to implemnet this myself ? 
>>
>>
>>
>> You may have a localized properties file for each Page, 
>> YourPage.properties. And you may access your localized strings simply 
>> by calling getMessage(msgKey) from your page class. You may also 
>> access it directly from your templates with the following notation: 
>> <span jwcid="@Insert" value="message:head"/> where "head" is the key 
>> in the localized properties file.
>
>
> I know about the page properties. I'm asking about localized strings 
> that is shared
> among all pages and can be accessed from the engine context. For 
> example if i need display names for
> my pages (pages are application resource). I'd like to put display 
> names in a shared propertise file.
> Furthermore I think that if a resource is not found for a page in its 
> propertise file it should be
> automatically searched in the <my application> propertise file. 

Sorry, can't be of help here.

>
>
>>
>>>
>>>
>>> Thanks
>>> Yaniv. 
>>
>>
>>
>> -Harish
>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Some beginner questions.

Posted by kpub <kp...@actcom.net.il>.
Hi,

Thanks for the reply but you didn't answered my questions (maybe it's my 
bad english?). I'm adding inline remarks.

Harish Krishnaswamy wrote:

>
> kpub wrote:
>
>> Hi,
>>
>> 1. What are the benefits of using global/visit over subclassing 
>> application/engine. 
>
>
> You may find my explanation of these objects at 
> http://myworkspace.sourceforge.net/Illustrating_Tapestry.html. Scroll 
> down to the "Framework - a flyby" section. 

This section dosen't answer my question why can't I subclass 
application/engine insted of using
global/visit it's just explain that such objects exist.

The part about the visit I now understand. By creating the visit 
pget.getVisit() we are triggering creating
of session+visit.

As for the global object I'm still wondering why?

>
>
>>
>> 2. If I use global/visit:  how can I access the corresponding 
>> application/engine from the
>>    global/visit context without subclassing the application/engine. 
>
>
> You may access the servlet and the engine from the page class by 
> calling getRequestCycle().getRequestContext().getServlet() and 
> getEngine() respectively. 

I was asking about getting the application/engine from the global/visit 
context, like from the
global/visit constructor.

>
>
>>
>> 3. I'd like to get localized strings from  <my 
>> application>.propertise file.
>>    Do I have to implemnet this myself ? 
>
>
> You may have a localized properties file for each Page, 
> YourPage.properties. And you may access your localized strings simply 
> by calling getMessage(msgKey) from your page class. You may also 
> access it directly from your templates with the following notation: 
> <span jwcid="@Insert" value="message:head"/> where "head" is the key 
> in the localized properties file.

I know about the page properties. I'm asking about localized strings 
that is shared
among all pages and can be accessed from the engine context. For example 
if i need display names for
my pages (pages are application resource). I'd like to put display names 
in a shared propertise file.
Furthermore I think that if a resource is not found for a page in its 
propertise file it should be
automatically searched in the <my application> propertise file.

>
>>
>>
>> Thanks
>> Yaniv. 
>
>
> -Harish
>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Some beginner questions.

Posted by Harish Krishnaswamy <hk...@comcast.net>.
kpub wrote:

> Hi,
>
> 1. What are the benefits of using global/visit over subclassing 
> application/engine. 

You may find my explanation of these objects at 
http://myworkspace.sourceforge.net/Illustrating_Tapestry.html. Scroll 
down to the "Framework - a flyby" section.

>
> 2. If I use global/visit:  how can I access the corresponding 
> application/engine from the
>    global/visit context without subclassing the application/engine. 

You may access the servlet and the engine from the page class by calling 
getRequestCycle().getRequestContext().getServlet() and getEngine() 
respectively.

>
> 3. I'd like to get localized strings from  <my application>.propertise 
> file.
>    Do I have to implemnet this myself ? 

You may have a localized properties file for each Page, 
YourPage.properties. And you may access your localized strings simply by 
calling getMessage(msgKey) from your page class. You may also access it 
directly from your templates with the following notation: <span 
jwcid="@Insert" value="message:head"/> where "head" is the key in the 
localized properties file.

>
>
> Thanks
> Yaniv. 

-Harish

>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org