You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "jam.ntk" <ja...@gmail.com> on 2012/09/14 14:04:43 UTC

Generating markup from Wicket

Hi - I have data strings coming from database e.g. ABC, 123, DEF,456. Now I
am creating a MultilineLabel to hold the string with new line characters to
diplay on the page with line breaks. It is working fine but I want to
display them as mark up list items as it would display with the following
mark up. Can you please suggest how i can do this in Wicket code as my model
is being created in wicket? Do I need to use WebMarkupContainer instead of
MultiLineLabel?

<ul>
    <li>ABC</li>
    <li>123</li>
    <li>DEF</li>
    <li>456</li>
</ul>

dbLabelText = ABC.append("\n").123......
add(new MultiLineLabel("label", dbLabelText));

Please give an example.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generating-markup-from-Wicket-tp4652003.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Generating markup from Wicket

Posted by Sven Meier <sv...@meiers.net>.
Here's the sample code:

<ul>
     <li wicket:id="strings">
         <span wicket:id="string"></span>
     </li>
</ul>

IModel<String> strings = ...;
  
add(new ListView("strings", strings)) {
   protected void populateItem(ListItem<String> item) {
     item.add(new Label("string", item.getModel()));
   }
};

Not too much code for an always up-to-date rendered list with clean separation of markup and code.

Sven


On 09/14/2012 02:55 PM, jam.ntk wrote:
> Thanks, I think i can achieve this simply by adding mark up tags in the
> wicket code.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generating-markup-from-Wicket-tp4652003p4652005.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: Generating markup from Wicket

Posted by "jam.ntk" <ja...@gmail.com>.
Thanks, I think i can achieve this simply by adding mark up tags in the
wicket code.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generating-markup-from-Wicket-tp4652003p4652005.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Generating markup from Wicket

Posted by vineet semwal <vi...@gmail.com>.
use a repeater

On Fri, Sep 14, 2012 at 5:34 PM, jam.ntk <ja...@gmail.com> wrote:
> Hi - I have data strings coming from database e.g. ABC, 123, DEF,456. Now I
> am creating a MultilineLabel to hold the string with new line characters to
> diplay on the page with line breaks. It is working fine but I want to
> display them as mark up list items as it would display with the following
> mark up. Can you please suggest how i can do this in Wicket code as my model
> is being created in wicket? Do I need to use WebMarkupContainer instead of
> MultiLineLabel?
>
> <ul>
>     <li>ABC</li>
>     <li>123</li>
>     <li>DEF</li>
>     <li>456</li>
> </ul>
>
> dbLabelText = ABC.append("\n").123......
> add(new MultiLineLabel("label", dbLabelText));
>
> Please give an example.
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Generating-markup-from-Wicket-tp4652003.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
regards,

Vineet Semwal

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