public int doEndTag() throws JspException {
StringBuffer buf = new StringBuffer();
List l = new ArrayList();
for(Iterator i = CoreServlet.getServlet().getPageScripts().iterator(); i.hasNext(); ) {
CoreScript script = (CoreScript)i.next();
if(script.getPosition() == Integer.parseInt(position)) {
l.add(script);
}
}
for(Iterator i = l.iterator(); i.hasNext(); ) {
CoreScript script = (CoreScript)i.next();
buf.append("\n<script");
if(script.getLanguage() != null) {
buf.append(" language=\"");
buf.append(script.getLanguage());
buf.append("\"");
}
if(script.getType() != null) {
buf.append(" type=\"");
buf.append(script.getType());
buf.append("\"");
}
if(script.getPath() != null) {
buf.append(" src=\"");
buf.append(script.getPath());
buf.append("\">\n");
buf.append("document.write(\"Included JS file not found\")");
buf.append("</script>");
}
else {
if(script.getScript() != null) {
buf.append(">");
buf.append(script.getScript());
buf.append("</script>");
}
else {
buf.append(">\n");
buf.append("document.write(\"Included JS file not found\")");