Python django
View more presentations from Ronald Cuello.
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd">
<tlib-version>1.0</tlib-version>
<short-name>mxdescriptor</short-name>
<uri>/WEB-INF/mxdescriptor</uri>
<description>
Mis primeras etiquetas
</description>
<tag>
<name>welcomeTag</name>
<tag-class>mx.jsp.tags.HelloWorldTag</tag-class>
<bodycontent>empty</bodycontent>
</tag>
</taglib>
package mx.jsp.tags;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;
public class HelloWorldTag implements Tag{
private PageContext pageContext;
private Tag parent;
public void setPageContext(PageContext pc) {
pageContext=pc;
}
public void setParent(Tag t) {
parent=t;
}
public Tag getParent() {
return parent;
}
public int doStartTag() throws JspException {
try{
pageContext.getOut().write("<b>Hola mundo</b>");
}catch(IOException e){
throw new JspTagException("An IOException occurred.");
}
return SKIP_BODY;
}
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
public void release() {
pageContext=null;
parent=null;
}
}
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/mxdescriptor.tld" prefix="mx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<mx:welcomeTag />
</body>
</html>