You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/10/04 03:34:05 UTC

T5: retrieve user defined parameter at start of Tapestry

Hi,

I'm thinking of putting some parameters in web.xml and retrieve them when
the application starts, any hint how to do this? Thanks.
A.C.
-- 
View this message in context: http://www.nabble.com/T5%3A-retrieve-user-defined-parameter-at-start-of-Tapestry-tf4565342.html#a13031181
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: retrieve user defined parameter at start of Tapestry

Posted by Christian Köberl POI <ch...@porsche.co.at>.
Hello Angelo!


Angelo Chen wrote:
> 
> I tried to do following, but does not work:
> 1. i added a param in the web.xml:
>  <context-param>
>               <param-name>tapestry.app-package</param-name>
>               <param-value>org.test</param-value>
> 
>               <param-name>test</param-name>
>               <param-value>myparam</param-value>
>  </context-param>
> 

You have to define each context parameter seperately:

 <context-param>
              <param-name>tapestry.app-package</param-name>
              <param-value>org.test</param-value>
 </context-param>

 <context-param>
              <param-name>test</param-name>
              <param-value>myparam</param-value>
 </context-param>

Then it should work.

Chris

PS: you can also use the ApplicationGlobals in your AppModule to use it in
other services (e.g. for things you want to do during startup).



-- 
View this message in context: http://www.nabble.com/T5%3A-retrieve-user-defined-parameter-at-start-of-Tapestry-tf4565342.html#a13042750
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: retrieve user defined parameter at start of Tapestry

Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Chris,

I tried to do following, but does not work:
1. i added a param in the web.xml:

 <context-param>
              <param-name>tapestry.app-package</param-name>
              <param-value>org.test</param-value>

              <param-name>test</param-name>
              <param-value>myparam</param-value>
 </context-param>
2. then i tried to access it in the program:
 @Inject
    private ApplicationGlobals globals;
   System.out.println(globals.getServletContext().getInitParameter("test"));
it just got an exception during starting up:
Construction of service ComponentClassResolver failed:

I'm sure i made a mistake, but where is that? Thanks.
A.C.


Christian Köberl POI wrote:
> 
> 
> Angelo Chen wrote:
>> 
>> I'm thinking of putting some parameters in web.xml and retrieve them when
>> the application starts, any hint how to do this? Thanks.
>> A.C.
>> 
> Create a new Service, Inject the ApplicationGlobals and get the parameters
> out of the ServletContext in ApplicationGlobals.
> 
> Chris
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-retrieve-user-defined-parameter-at-start-of-Tapestry-tf4565342.html#a13039666
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: retrieve user defined parameter at start of Tapestry

Posted by Christian Köberl POI <ch...@porsche.co.at>.

Angelo Chen wrote:
> 
> I'm thinking of putting some parameters in web.xml and retrieve them when
> the application starts, any hint how to do this? Thanks.
> A.C.
> 
Create a new Service, Inject the ApplicationGlobals and get the parameters
out of the ServletContext in ApplicationGlobals.

Chris
-- 
View this message in context: http://www.nabble.com/T5%3A-retrieve-user-defined-parameter-at-start-of-Tapestry-tf4565342.html#a13035379
Sent from the Tapestry - User mailing list archive at Nabble.com.


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