Search in sources :

Example 81 with JspWriter

use of javax.servlet.jsp.JspWriter in project jodd by oblac.

the class FormTag method doAfterBody.

/**
	 * Performs smart form population.
	 */
@Override
public int doAfterBody() throws JspException {
    BodyContent body = getBodyContent();
    JspWriter out = body.getEnclosingWriter();
    String bodytext = populateForm(body.getString(), new FormFieldResolver() {

        public Object value(String name) {
            return JspResolver.value(name, pageContext);
        }
    });
    try {
        out.print(bodytext);
    } catch (IOException ioex) {
        throw new JspException(ioex);
    }
    return SKIP_BODY;
}
Also used : BodyContent(javax.servlet.jsp.tagext.BodyContent) JspException(javax.servlet.jsp.JspException) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter)

Example 82 with JspWriter

use of javax.servlet.jsp.JspWriter in project jodd by oblac.

the class DebugTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    PageContext pageContext = (PageContext) getJspContext();
    JspWriter out = getJspContext().getOut();
    out.println(ServletUtil.debug(pageContext));
}
Also used : PageContext(javax.servlet.jsp.PageContext) JspWriter(javax.servlet.jsp.JspWriter)

Example 83 with JspWriter

use of javax.servlet.jsp.JspWriter in project sonarqube by SonarSource.

the class BaseTag method doStartTag.

/**
     * Process the start of this tag.
     *
     * @throws JspException if a JSP exception has occurred
     */
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    String serverName = (this.server == null) ? request.getServerName() : this.server;
    int port = request.getServerPort();
    String headerHost = request.getHeader("Host");
    if ((serverName == null) && (headerHost != null)) {
        StringTokenizer tokenizer = new StringTokenizer(headerHost, ":");
        serverName = tokenizer.nextToken();
        if (tokenizer.hasMoreTokens()) {
            String portS = tokenizer.nextToken();
            try {
                port = Integer.parseInt(portS);
            } catch (Exception e) {
                port = 80;
            }
        } else {
            port = 80;
        }
    }
    String baseTag = renderBaseElement(request.getScheme(), serverName, port, request.getRequestURI());
    JspWriter out = pageContext.getOut();
    try {
        out.write(baseTag);
    } catch (IOException e) {
        pageContext.setAttribute(Globals.EXCEPTION_KEY, e, PageContext.REQUEST_SCOPE);
        throw new JspException(messages.getMessage("common.io", e.toString()));
    }
    return EVAL_BODY_INCLUDE;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) StringTokenizer(java.util.StringTokenizer) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter) JspException(javax.servlet.jsp.JspException) IOException(java.io.IOException)

Example 84 with JspWriter

use of javax.servlet.jsp.JspWriter in project head by mifos.

the class TableTag method getMultipleData.

private void getMultipleData(List list, Locale locale, Integer currentValue) throws TableTagTypeParserException, TableTagParseException, TableTagException, JspException, IOException, PageExpiredException {
    StringBuilder result = new StringBuilder();
    JspWriter out = pageContext.getOut();
    createStartTable(result, true, false);
    out.write(result.toString());
    int number = ((currentValue - 1) * pageSize);
    for (Object object : list) {
        Table table = helperMultipleData(object, locale);
        if (table != null) {
            displayDataMultiple(object, table, ++number, locale);
        } else {
            throw new JspException(MessageLookup.getLocalizedMessage(TableTagConstants.TABLENOTFOUND_ERROR));
        }
    }
    result = new StringBuilder();
    createEndTable(result, false);
    String action = (String) SessionUtils.getAttribute("action", pageContext.getSession());
    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>");
}
Also used : JspException(javax.servlet.jsp.JspException) JspWriter(javax.servlet.jsp.JspWriter)

Example 85 with JspWriter

use of javax.servlet.jsp.JspWriter in project head by mifos.

the class TableTag method getSingleData.

private void getSingleData(List list, Locale locale, Integer currentValue) throws TableTagParseException, TableTagException, JspException, IOException, PageExpiredException {
    String xmlFilePath = getSingleFile();
    Table table = helperCache(xmlFilePath, name);
    if (table != null) {
        StringBuilder result = new StringBuilder();
        JspWriter out = pageContext.getOut();
        boolean headingRequired = table.getPageRequirements().getHeadingRequired().equalsIgnoreCase("true");
        boolean topBlueLineRequired = table.getPageRequirements().getTopbluelineRequired().equalsIgnoreCase("true");
        createStartTable(result, headingRequired, topBlueLineRequired);
        out.write(result.toString());
        displayData(list, table, locale, currentValue);
    } else {
        throw new JspException(MessageLookup.getLocalizedMessage(TableTagConstants.TABLENOTFOUND_ERROR));
    }
}
Also used : JspException(javax.servlet.jsp.JspException) JspWriter(javax.servlet.jsp.JspWriter)

Aggregations

JspWriter (javax.servlet.jsp.JspWriter)145 IOException (java.io.IOException)72 JspException (javax.servlet.jsp.JspException)68 HttpServletRequest (javax.servlet.http.HttpServletRequest)17 JspWriteRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException)14 PageContext (javax.servlet.jsp.PageContext)13 Iterator (java.util.Iterator)9 Engine (org.apache.wiki.api.core.Engine)9 JspContext (javax.servlet.jsp.JspContext)8 JspTagException (javax.servlet.jsp.JspTagException)8 OuterFormTagMissingRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException)7 ArrayList (java.util.ArrayList)6 Properties (java.util.Properties)6 HttpSession (javax.servlet.http.HttpSession)5 BodyContent (javax.servlet.jsp.tagext.BodyContent)5 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)5 Page (org.apache.wiki.api.core.Page)5 HtmlCode (org.compiere.util.HtmlCode)5 MissingParametersRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.MissingParametersRuntimeException)5 IPropertyRuleIntrospector (org.jaffa.rules.IPropertyRuleIntrospector)5