You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kelly.Graus" <Ke...@toltech.net> on 2008/04/11 23:08:27 UTC

[S2] Textfield key with resource bundle

Hello,

I'm trying to use the key attribute in the s:textfield tag to display a
label from my resource bundle.  I have a single application resource bundle
that I am able to access with the s:text tag, so I know the resource bundle
is working.  However, when I use the key attribute, I just get an empty
string as the label.

This works:

<s:text name="user.firstname"/>

This doesn't display the label:

<s:textfield key="user.firstname" name="..."/>


Does anyone have any ideas?

Thanks!

Kelly
-- 
View this message in context: http://www.nabble.com/-S2--Textfield-key-with-resource-bundle-tp16629036p16629036.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [S2] Textfield key with resource bundle

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Kelly.Graus wrote:
>
> Hi Jeremy,
>
> I worked on this all morning, and I believe I'm at the exact same place I
> was before when it was breaking, but everything works fine now.
>
> My model doesn't have a getText( String ) function, so I don't think that
> was it.
>
> If I run across it again, I will make a copy of the project and send it to
> you.
>
> Kelly
>   

Thanks for putting some time and effort in to help!

regards,
 Jeromy Evans

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


Re: [S2] Textfield key with resource bundle

Posted by "Kelly.Graus" <Ke...@toltech.net>.

Jeromy Evans - Blue Sky Minds wrote:
> 
> 
> Thanks Kelly, that would be great because I'm sure there's a bug here 
> that's hard to replicate.
> The model for ModelDriven gets pushed in front of the action.  If it had 
> a getText(String) method it would have caused this problem.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
Hi Jeremy,

I worked on this all morning, and I believe I'm at the exact same place I
was before when it was breaking, but everything works fine now.

My model doesn't have a getText( String ) function, so I don't think that
was it.

If I run across it again, I will make a copy of the project and send it to
you.

Kelly
-- 
View this message in context: http://www.nabble.com/-S2--Textfield-key-with-resource-bundle-tp16629036p16678823.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [S2] Textfield key with resource bundle

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Kelly Graus wrote:
> Hi Jeromy,
>
> I'm using struts 2.0.11. My resource bundle is in the WEB-INF/classes 
> directory. My action extends ActionSupport, and implements ModelDriven 
> and preparable. I couldn't get the ModelDriven stuff to work 
> correctly, and at some point when I was playing around with it, the 
> text started being displayed correctly. I will play around with it and 
> see if I can get it to break again.
>
> Kelly
>
Thanks Kelly, that would be great because I'm sure there's a bug here 
that's hard to replicate.
The model for ModelDriven gets pushed in front of the action.  If it had 
a getText(String) method it would have caused this problem.

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


Re: [S2] Textfield key with resource bundle

Posted by Kelly Graus <ke...@toltech.net>.
Hi Jeromy,

I'm using struts 2.0.11. My resource bundle is in the WEB-INF/classes  
directory. My action extends ActionSupport, and implements ModelDriven  
and preparable. I couldn't get the ModelDriven stuff to work  
correctly, and at some point when I was playing around with it, the  
text started being displayed correctly. I will play around with it and  
see if I can get it to break again.

Kelly

On Apr 11, 2008, at 7:57 PM, Jeromy Evans <jeromy.evans@blueskyminds.com.au 
 > wrote:

> Hi Kelly,
>
> By coincidence I'm investigating this precise issue at the moment  
> and have discussed it in the strust-dev list within the last 24  
> hours.  The algorithm to find keys in s:text differs from  
> s:textfield which causes inconsistent behaviour -sometimes-.
>
> Some questions:
> Which version of struts2 are you using?
> Where is your resource bundle?
> Does your action extend ActionSupport?
>
> Please let me know if you get it working and what changed.
>
> The issue:
> s:textfield searches for a method getText(String) somewhere in the  
> value stack. s:text searches for a TextProvider (like ActionSupport)  
> in the value stack and calls getText(String).  Something in your  
> configuration means the first approach doesn't find the resource but  
> the second approach does.  It's hard to replicate.
>
> Kelly.Graus wrote:
>> Hello,
>>
>> I'm trying to use the key attribute in the s:textfield tag to  
>> display a
>> label from my resource bundle.  I have a single application  
>> resource bundle
>> that I am able to access with the s:text tag, so I know the  
>> resource bundle
>> is working.  However, when I use the key attribute, I just get an  
>> empty
>> string as the label.
>>
>> This works:
>>
>> <s:text name="user.firstname"/>
>>
>> This doesn't display the label:
>>
>> <s:textfield key="user.firstname" name="..."/>
>>
>>
>> Does anyone have any ideas?
>>
>> Thanks!
>>
>> Kelly
>>
>
>
> ---------------------------------------------------------------------
> 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


Re: [S2] Textfield key with resource bundle

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Hi Kelly,

By coincidence I'm investigating this precise issue at the moment and 
have discussed it in the strust-dev list within the last 24 hours.  The 
algorithm to find keys in s:text differs from s:textfield which causes 
inconsistent behaviour -sometimes-.

Some questions:
Which version of struts2 are you using?
Where is your resource bundle?
Does your action extend ActionSupport?

Please let me know if you get it working and what changed.

The issue:
s:textfield searches for a method getText(String) somewhere in the value 
stack. s:text searches for a TextProvider (like ActionSupport) in the 
value stack and calls getText(String).  Something in your configuration 
means the first approach doesn't find the resource but the second 
approach does.  It's hard to replicate.

Kelly.Graus wrote:
> Hello,
>
> I'm trying to use the key attribute in the s:textfield tag to display a
> label from my resource bundle.  I have a single application resource bundle
> that I am able to access with the s:text tag, so I know the resource bundle
> is working.  However, when I use the key attribute, I just get an empty
> string as the label.
>
> This works:
>
> <s:text name="user.firstname"/>
>
> This doesn't display the label:
>
> <s:textfield key="user.firstname" name="..."/>
>
>
> Does anyone have any ideas?
>
> Thanks!
>
> Kelly
>   


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