Dynamic Custom Layout

Hi everyone,

CustomLayout leftmenu3 = new CustomLayout("leftmenu3");

String divString1 = "<div location='" + "loc";
String divString3 = "' ></div>";
String divStringAppended = "";
for (int i = 0; i < 2; i++) {
	divStringAppended += divString1 + i + divString3;
}

Label htmlDiv = new Label(divStringAppended);
htmlDiv.setContentMode(ContentMode.HTML);
leftmenu3.addComponent((Component) htmlDiv, "leftMenuLinks");

for (int i = 0; i < 2; i++) {
	Label htmlLabel = null;
	if (i == 0)
		htmlLabel = new Label("<a>About</a>");
	if (i == 1)
		htmlLabel = new Label("<a>Services</a>");
	htmlLabel.setContentMode(ContentMode.HTML);
	leftmenu3.addComponent((Component) htmlLabel, "loc" + i);
}

My CustomLayout is:

<div location="leftMenuLinks"></div>

And the output is:

<div location="leftMenuLinks">
	<div class="v-label v-widget v-label-undef-w">
		<div location="loc0"></div>
		<div location="loc1"></div>
	</div>
</div>

I’m total beginner in vaadin. What I’m trying to achieve is:

I have sidebar menu and I want to fill this menu dynamically. For this I have 1 div in custom layout and I fill this with 2 new div with java. And trying to add <a> tags in them. But as you see in the output there are only divs not <a> tags. Sorry for my bad English, I hope you can understand what I’m trying to do with only codes. Any advice will help, thanks.