You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2007/08/07 16:18:28 UTC

how to set global constants cross all of the scripts ?

inside jsp/struts 1.3, how can i set global constants that i can make change one place, but can make all the corrspondent change cross all the files.
   
  for example, if i have script file 1.jsp, 2.jsp ......n.jsp, all the file contains 
       <a href="www.test.com">
   
  any way i can set it as <a href="@website">, then i change one place, could make change all the scripts?
   
  tks in advance
   
  john

       
---------------------------------
Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. 

Re: how to set global constants cross all of the scripts ?

Posted by Laurie Harper <la...@holoweb.net>.
Another alternative would be to put those definitions into a resource 
bundle (properties file). As long as all references are indirected 
through some collection of definitions, it doesn't really matter where 
those definitions are stored / setup :=)

L.

Paul Benedict wrote:
> If you want to link to absolute URLs, perform a JSP include at the top of
> your pages. The included page should contain all the definitions you need.
> Alternatively, you can write yourself a ContextListener to put attributes
> into application scope.
> 
> If you want to link to other Struts actions, use the actionId attribute.
> 
> Paul
> 
> On 8/7/07, john lee <sh...@yahoo.com> wrote:
>> inside jsp/struts 1.3, how can i set global constants that i can make
>> change one place, but can make all the corrspondent change cross all the
>> files.
>>
>>   for example, if i have script file 1.jsp, 2.jsp ......n.jsp, all the
>> file contains
>>        <a href="www.test.com">
>>
>>   any way i can set it as <a href="@website">, then i change one place,
>> could make change all the scripts?
>>
>>   tks in advance
>>
>>   john
>>
>>
>> ---------------------------------
>> Moody friends. Drama queens. Your life? Nope! - their life, your story.
>> Play Sims Stories at Yahoo! Games.
> 


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


Re: how to set global constants cross all of the scripts ?

Posted by john lee <sh...@yahoo.com>.
would you mind giving me some example?
   
  tks in advance.
   
  john
   
  

Paul Benedict <pb...@apache.org> wrote:
  If you want to link to absolute URLs, perform a JSP include at the top of
your pages. The included page should contain all the definitions you need.
Alternatively, you can write yourself a ContextListener to put attributes
into application scope.

If you want to link to other Struts actions, use the actionId attribute.

Paul

On 8/7/07, john lee wrote:
>
> inside jsp/struts 1.3, how can i set global constants that i can make
> change one place, but can make all the corrspondent change cross all the
> files.
>
> for example, if i have script file 1.jsp, 2.jsp ......n.jsp, all the
> file contains
> 
>
> any way i can set it as , then i change one place,
> could make change all the scripts?
>
> tks in advance
>
> john
>
>
> ---------------------------------
> Moody friends. Drama queens. Your life? Nope! - their life, your story.
> Play Sims Stories at Yahoo! Games.


       
---------------------------------
Got a little couch potato? 
Check out fun summer activities for kids.

Re: how to set global constants cross all of the scripts ?

Posted by Paul Benedict <pb...@apache.org>.
If you want to link to absolute URLs, perform a JSP include at the top of
your pages. The included page should contain all the definitions you need.
Alternatively, you can write yourself a ContextListener to put attributes
into application scope.

If you want to link to other Struts actions, use the actionId attribute.

Paul

On 8/7/07, john lee <sh...@yahoo.com> wrote:
>
> inside jsp/struts 1.3, how can i set global constants that i can make
> change one place, but can make all the corrspondent change cross all the
> files.
>
>   for example, if i have script file 1.jsp, 2.jsp ......n.jsp, all the
> file contains
>        <a href="www.test.com">
>
>   any way i can set it as <a href="@website">, then i change one place,
> could make change all the scripts?
>
>   tks in advance
>
>   john
>
>
> ---------------------------------
> Moody friends. Drama queens. Your life? Nope! - their life, your story.
> Play Sims Stories at Yahoo! Games.