use of javax.servlet.jsp.JspWriter in project tomcat by apache.
the class ShowSource method doEndTag.
@Override
public int doEndTag() throws JspException {
if ((jspFile.indexOf("..") >= 0) || (jspFile.toUpperCase(Locale.ENGLISH).indexOf("/WEB-INF/") != 0) || (jspFile.toUpperCase(Locale.ENGLISH).indexOf("/META-INF/") != 0))
throw new JspTagException("Invalid JSP file " + jspFile);
try (InputStream in = pageContext.getServletContext().getResourceAsStream(jspFile)) {
if (in == null)
throw new JspTagException("Unable to find JSP file: " + jspFile);
JspWriter out = pageContext.getOut();
try {
out.println("<body>");
out.println("<pre>");
for (int ch = in.read(); ch != -1; ch = in.read()) if (ch == '<')
out.print("<");
else
out.print((char) ch);
out.println("</pre>");
out.println("</body>");
} catch (IOException ex) {
throw new JspTagException("IOException: " + ex.toString());
}
} catch (IOException ex2) {
throw new JspTagException("IOException: " + ex2.toString());
}
return super.doEndTag();
}
use of javax.servlet.jsp.JspWriter in project head by mifos.
the class MifosImageTag method doStartTag.
/**
* Function to render the tag
*
* @throws JspException
*/
@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
ResourceBundle resource = getResourceBundle();
path = resource.getString(getId());
try {
out.println(render());
} catch (IOException e) {
e.printStackTrace();
}
return SKIP_BODY;
}
use of javax.servlet.jsp.JspWriter in project head by mifos.
the class TableTag method displayData.
private void displayData(List list, Table table, Locale locale, Integer currentValue) throws TableTagException, IOException, JspException {
JspWriter out = pageContext.getOut();
int number = ((currentValue - 1) * pageSize);
for (Iterator it = list.iterator(); it.hasNext(); ) {
Object object = it.next();
boolean isFlowRequired = table.getPageRequirements().getFlowRequired().equalsIgnoreCase("true") ? true : false;
String data = table.getTable(pageContext, object, locale, isFlowRequired);
if (data == null) {
throw new JspException("XML.filenotfound");
}
if (table.getPageRequirements().getNumbersRequired().equalsIgnoreCase("true")) {
out.write("<tr class=\"fontnormal\"><td width=\"3%\" ");
if (table.getPageRequirements().getValignnumbers().equalsIgnoreCase("true")) {
out.write("valign=\"top\"");
}
out.write(">");
out.write((++number) + ".</td><td width=\"97%\"");
}
out.write(data);
if (table.getPageRequirements().getBlanklinerequired().equalsIgnoreCase("true")) {
if (it.hasNext()) {
out.write("<br />");
}
}
if (table.getPageRequirements().getBluelineRequired().equalsIgnoreCase("true")) {
if (it.hasNext()) {
out.write("<tr><td colspan=\"2\" valign=\"top\" class=\"blueline\">");
out.write("<img src=\"pages/framework/images/trans.gif \" width=\"10\" height=\"5\"></td></tr>");
}
}
out.write("</td></tr>");
}
StringBuilder result = new StringBuilder();
boolean bottomBlueLineRequired = table.getPageRequirements().getBottombluelineRequired().equalsIgnoreCase("true");
createEndTable(result, bottomBlueLineRequired);
String action = getAction(table);
out.write(result.toString());
String currentFlowkey = (String) ((HttpServletRequest) pageContext.getRequest()).getAttribute(Constants.CURRENTFLOWKEY);
String perspective = (String) ((HttpServletRequest) pageContext.getRequest()).getAttribute(RequestConstants.PERSPECTIVE);
out.write(PageScroll.getPages(currentValue, pageSize, size, action, currentFlowkey, locale, perspective));
out.write("</table></td></tr>");
out.write("</table>");
}
use of javax.servlet.jsp.JspWriter in project head by mifos.
the class TableTag method doStartTag.
/**
* Function to render the tag
*/
@Override
public int doStartTag() throws JspException {
// call the helper method to display the result.
try {
// Value of the list which we are getting from the Cache
List list = getList();
if (list == null) {
return super.doStartTag();
}
if (list.size() == 0) {
JspWriter out = pageContext.getOut();
XmlBuilder result;
result = noResults((String) SessionUtils.getAttribute(Constants.OFFICE_NAME, (HttpServletRequest) pageContext.getRequest()), (String) SessionUtils.getAttribute(Constants.BRANCH_ID, (HttpServletRequest) pageContext.getRequest()), (String) SessionUtils.getAttribute(Constants.SEARCH_STRING, (HttpServletRequest) pageContext.getRequest()));
out.write(result.getOutput());
return super.doStartTag();
}
getTableData(list);
} catch (TableTagException tte) {
throw new JspException(tte);
} catch (TableTagParseException ttpe) {
throw new JspException(ttpe);
} catch (TableTagTypeParserException tttpe) {
throw new JspException(tttpe);
} catch (IOException ioe) {
throw new JspException(ioe);
} catch (HibernateSearchException hse) {
throw new JspException(hse);
} catch (PageExpiredException e) {
throw new JspException(e);
}
return super.doStartTag();
}
use of javax.servlet.jsp.JspWriter in project head by mifos.
the class TableTag method displayDataMultiple.
private void displayDataMultiple(Object object, Table table, int number, Locale locale) throws TableTagException, IOException, JspException {
String data = null;
JspWriter out = pageContext.getOut();
getAction(table);
boolean isFlowRequired = table.getPageRequirements().getFlowRequired().equalsIgnoreCase("true") ? true : false;
data = table.getTable(pageContext, object, locale, isFlowRequired);
out.write("<tr class=\"fontnormal\"><td width=\"3%\" valign=\"top\">");
out.write((number) + ".</td><td width=\"97%\">");
out.write(data);
if (table.getPageRequirements().getBlanklinerequired().equalsIgnoreCase("true")) {
out.write("<br />");
}
out.write("</td></tr>");
}
Aggregations