package org.japanosample.test.legacy;
import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTag;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import org.japano.Buffer;
import org.japano.metadata.annotation.JapanoAttribute;
import org.japano.metadata.annotation.JapanoTag;
@JapanoTag ( library="/test/legacy", bodyContent="scriptless" )
public class SimpleTagTest extends SimpleTagSupport
{
private JspFragment text;
private int times;
@JapanoAttribute ( required=true )
public void setText(JspFragment text)
{
this.text = text;
}
@JapanoAttribute ( required=true )
public void setTimes(int times)
{
this.times=times;
}
public void doTag() throws javax.servlet.jsp.JspException, java.io.IOException
{
Buffer tmp=new Buffer();
for (int i=0; i < times; i++)
text.invoke(tmp);
JspContext context=getJspContext();
context.setAttribute("foo", tmp.toString());
JspFragment body=getJspBody();
if (body != null)
body.invoke( context.getOut());
}
}