我正在使用 Vaadin 7。当我尝试将 html 内容添加到 CustomLayout 时,它不会在 div 元素内生成段落。这是输入:
<div style="margin-top: 10px; padding-left: 50px;" class="col-lg-10">
<div class="bs-component">
<ul class="nav nav-pills">
<li class="active"><a href="#Myprofile" class="active"
data-toggle="tab">Profile</a></li>
<li class=""><a href="#setting" data-toggle="tab">setting</a></li>
<li class=""><a href="#tasks" data-toggle="tab">Tasks</a></li>
</ul>
<div class="tabbable">
<div class="tab-content">
<div id="Myprofile" location="Myprofile" class="tab-pane active"></div>
<div id="setting" location="setting" class="tab-pane">
<p>My paragraph</p>
</div>
</div>
</div>
</div>
在java中我使用这个:
String html; //This var contain my input
InputStream is = new ByteArrayInputStream(html.getBytes());
CustomLayout custom = null;
try {
custom = new CustomLayout(is);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
最后,我将 customLayout 添加到 mainLayout 中。当我运行该应用程序时,我得到以下输出:
<div style="margin-top: 10px; padding-left: 50px;" class="col-lg-10">
<div class="bs-component">
<ul class="nav nav-pills">
<li class="active"><a href="#Myprofile" class="active"
data-toggle="tab">Profile</a></li>
<li class=""><a href="#setting" data-toggle="tab">setting</a></li>
<li class=""><a href="#tasks" data-toggle="tab">Tasks</a></li>
</ul>
<div class="tabbable">
<div class="tab-content">
<div id="Myprofile" location="Myprofile" class="tab-pane active"></div>
<div id="setting" location="setting" class="tab-pane">
</div>
</div>
</div>
</div>
我的 div 内带有 id=setting 的段落不是由 Vaadin 生成的。有解决这个问题的想法吗?
最佳答案
我找到了问题的根源。我删除了 div 元素中的 location="setting"部分,它起作用了。我不知道为什么它会这样做。可能是因为 CustomLayout 在生成 html 时会查找要放入该位置的元素,如果找不到,则会清除所有元素内容。
关于java - 瓦丁 : CustomLayout don't generate <div> content,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22984521/