Allow child components inside of wicket:message
-----------------------------------------------

                 Key: WICKET-1486
                 URL: https://issues.apache.org/jira/browse/WICKET-1486
             Project: Wicket
          Issue Type: New Feature
          Components: wicket
            Reporter: John Ray
         Attachments: Message.diff

Currently you can't put a link or text in the middle of a wicket:message. You 
need to break up the message into 2 parts as text before the link and text 
after the link. 

I've made a modification to the WicketMessageResolver class that allows you to 
nest child components inside a wicket:message and then reference them from the 
properties file. For example in the html
       <wicket:message key="myKey">
          This text will be replaced with text from the properties file.
          <span wicket:id="amount">[amount]</span>.
          <a wicket:id="link">
              <wicket:message key="linkText"/>
          </a>
       </wicket:message>
   
Then in the properties file have a variable with a name that matches the 
wicket:id for each child component. The variables can be in any order, they do 
NOT have to match the order in the HTML file.
       myKey=Your balance is ${amount}. Click ${link} to view the details.
       linkText=here
   
And in the java
       add(new Label("amount",new Model("$5.00")));
       add(new BookmarkablePageLink("link",DetailsPage.class));
   
In the browser this will output
   Your balance is $5.00. Click -here- to view the details.

I'll attach a quick start as well as an svn diff.
   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Reply via email to