本文整理汇总了Java中org.apache.ecs.html.Html类的典型用法代码示例。如果您正苦于以下问题:Java Html类的具体用法?Java Html怎么用?Java Html使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Html类属于org.apache.ecs.html包,在下文中一共展示了Html类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHeader
import org.apache.ecs.html.Html; //导入依赖的package包/类
protected void addHeader(Html html) {
//<head>
// <link rel="stylesheet" href="../../../../../resources/webapp/css/bootstrap.css" type="text/css" />
// </head>
String[] headerlinks = getContext().getHeaderlinks();
if (headerlinks != null && headerlinks.length > 0) {
String relativePath = constructRelativeLinkPath();
Head head = new Head();
for (String headerlink : headerlinks) {
Link link = new Link();
link.setRel("stylesheet");
link.setType("text/css");
link.setHref(relativePath + headerlink.trim());
head.addElement(link);
}
html.addElement(head);
}
}
示例2: getSource
import org.apache.ecs.html.Html; //导入依赖的package包/类
public String getSource(WebSession s)
{
String source = null;
String src = null;
try
{
// System.out.println("Loading source file: " +
// getSourceFileName());
src = convertMetacharsJavaCode(readFromFile(new BufferedReader(new FileReader(s
.getWebResource(getSourceFileName()))), true));
// TODO: For styled line numbers and better memory efficiency,
// use a custom FilterReader
// that performs the convertMetacharsJavaCode() transform plus
// optionally adds a styled
// line number. Wouldn't color syntax be great too?
} catch (Exception e)
{
s.setMessage("Could not find source file");
src = ("Could not find the source file or source file does not exist.<br/>"
+ "Send this message to: <a href=\"mailto:" + s.getWebgoatContext().getFeedbackAddress()
+ "?subject=Source " + getSourceFileName() + " not found. Lesson: "
+ s.getCurrentLesson().getLessonName() + "\">" + s.getWebgoatContext().getFeedbackAddress() + "</a>");
}
Html html = new Html();
Head head = new Head();
head.addElement(new Title(getSourceFileName()));
Body body = new Body();
body.addElement(new StringElement(src));
html.addElement(head);
html.addElement(body);
source = html.toString();
return source;
}
示例3: createHtml
import org.apache.ecs.html.Html; //导入依赖的package包/类
public Html createHtml() {
final Html html = new Html();
html.addAttribute("xmlns:wicket", "http://wicket.apache.org");
return html;
}
示例4: newHtml
import org.apache.ecs.html.Html; //导入依赖的package包/类
@Override
protected Html newHtml() {
Html html = super.newHtml();
addTablegrid();
return html;
}