wicket:message is not intended to be used on actual wicket components,
only on raw markup. if you have a component then its trivial to add
the localized attribute from code. remember, wicket prefers everything
to be done from code. wicket:message exists because creating a markup
container in code and adding the attribute that way is too noisy since
the container would serve no other function.

-igor

On Fri, Apr 30, 2010 at 2:14 AM, Xavier López <xavil...@gmail.com> wrote:
> Hasn't anybody else been in this situation ? I finally checked it is
> necessary for a regular tag with a wicket:message attribute and with wicket
> component childs to be also a wicket component... Maybe it would be nice to
> have this information on the wiki page talking about the wicket:message
> attribute...
>
> This example would give the error:
>
> public class TestPage extends Page {
> public TestPage(){
> add(new Label("childLabel", "Sample text for the label"));
> }
> }
>
> <html>
> <body>
> <table wicket:message="summary:anyResourceKey">
> <tr><td><span wicket:id="childLabel"></span></td></tr>
> </table>
> </body>
> </html>
>
>
> The only way I see to get around it is to :
> public class TestPage extends Page {
> public TestPage(){
> WebMarkupContainer cont = new WebMarkupContainer("cont");
> add(cont);
> cont.add(new Label("childLabel", "Sample text for the label"));
> }
> }
>
> <html>
> <body>
> <table wicket:id="cont" wicket:message="summary:anyResourceKey">
> <tr><td><span wicket:id="childLabel"></span></td></tr>
> </table>
> </body>
> </html>
>
> Cheers,
> Xavier
>
> 2010/4/29 Xavier López <xavil...@gmail.com>
>
>> Yes, you are right, Wilhelmsen, and that's what Wicket is doing, I
>> understand that correctly. The problem is, when I have a wicket component
>> attached to that <table> tag. Wicket seems to treat that <table> as a
>> component, with autogenerated wicket:id, and logically, expects the child
>> components (in markup) to be added to it. I suppose I have to manually model
>> that <table> into a wicket component (i.e. WebMarkupContainer) in order to
>> be able to add those child components to it and let Wicket process the
>> component hierarchy correctly...
>>
>>
>> BTW, I just noticed I wrote the last message incorrectly:
>>
>> <input type="text" wicket:message="title:myresource"></input>
>>
>> Turns into
>>
>> <input type="text" title="Test Title"></input>
>>
>>
>> Thanks,
>> Xavier
>>
>> 2010/4/29 Wilhelmsen Tor Iver <toriv...@arrive.no>
>>
>> > i meant where do you expect the localized message to be rendered into?
>>> > if wicket:message is attached to the table tag?
>>>
>>> Well, since he is using the attribute version of wicket:message, I guess
>>> he expects the output from
>>>
>>> > >> <table wicket:message="summary:myresource">
>>>
>>> to be
>>>
>>> <table summary="localized message with key myresource">
>>>
>>> - Tor Iver
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to