struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Roughley <...@fdar.com>
Subject Re: [S2] <s:text> issue
Date Fri, 02 Feb 2007 20:25:34 GMT
My mistake, you're right.  I also thought you were looking for a 
specific answer :)

I believe the text tag only looks up keys from property files, to obtain 
a value that is on the stack you want to use the property tag.

/Ian



Wesley Wannemacher wrote:
> I could be wrong, but you may be misunderstanding the poster's intent. He
> has a variable on the value stack that indicates which property key he wants
> to retrieve. If my understanding is correct, then I would not really be any
> help, but has the OP tried: 
>
> <s:text name="%{myKey}" /> 
>
> ?
>
> P.S. I have a post from last week or before where I had a bunch of trouble
> understanding OGNL and it might help you if you want it off-list. 
>
>   
>> -----Original Message-----
>> From: Ian Roughley [mailto:ian@fdar.com] 
>> Sent: Friday, February 02, 2007 3:07 PM
>> To: Struts Users Mailing List
>> Subject: Re: [S2] <s:text> issue
>>
>> I think you may be confused, you say
>>
>> The value of myKey is "some.resource.key", and in the
>> property file I have:
>>
>>     some.resource.key = Some text
>>
>> In fact, "some.resource.key" is the key and "some text" is the value.
>>
>> Try -
>>
>> <s:text name="some.resource.key" />
>>
>>
>> /Ian
>>
>> -- 
>> From Down & Around, Inc.
>> Innovative IT Solutions
>> Software Architecture * Design * Development
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> web:      www.fdar.com  
>> email     ian@fdar.com  
>> phone:    617.821.5430
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>>
>>
>> Djordje Trifunovic wrote:
>>     
>>> Hi,
>>>
>>>  
>>>
>>> Using Struts2 (2.0.5 snapshot) in a project, I hit the 
>>>       
>> following problem: I
>>     
>>> have a resource bundle key that I need to use with <s:text> 
>>>       
>> tag to retrieve
>>     
>>> a text from my resource bundle. The name of the key is in a 
>>>       
>> property myKey
>>     
>>> in the value stack. The value of myKey is 
>>>       
>> "some.resource.key", and in the
>>     
>>> property file I have:
>>>
>>>  
>>>
>>>     some.resource.key = Some text
>>>
>>>  
>>>
>>> I tried:
>>>
>>>  
>>>
>>>     <s:text name="#myKey" />
>>>
>>>  
>>>
>>> but that doesn't work as I expected. Instead of getting 
>>>       
>> "Some text" on my
>>     
>>> page, or at least "some.resource.key", I get "#myKey" 
>>>       
>> instead. Just to be
>>     
>>> sure everything is ok in the value stack, I tried:
>>>
>>>  
>>>
>>>     <s:property value="#myKey" />
>>>
>>>  
>>>
>>> And that returns "some.resource.key", as expected. Am I 
>>>       
>> missing something
>>     
>>> here?
>>>
>>>  
>>>
>>> Thanks,
>>>
>>> Djordje Trifunovic
>>>
>>>  
>>>
>>> PS. I am sorry if the issue was already discussed. I didn't 
>>>       
>> find it quickly
>>     
>>> searching through archive.
>>>
>>>  
>>>
>>>
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     

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


Mime
View raw message