Package javax.servlet.jsp

Examples of javax.servlet.jsp.JspWriter


            results.append(getJavascriptEnd());
        }


        JspWriter writer = pageContext.getOut();
        try {
            writer.print(results.toString());
        }
        catch (IOException e) {
            throw new JspException(e.getMessage());
        }
View Full Code Here


            }
            if (rules.size() == 0) {
                throw new JspException("no valang validation rules were found");
            }

            JspWriter out = pageContext.getOut();
            out.write("<script type=\"text/javascript\" id=\"");
            out.write(commandName + "ValangValidator");
            out.write("\">");
            translator.writeJavaScriptValangValidator(out, commandName, true, rules, new MessageSourceAccessor(
                getRequestContext().getWebApplicationContext(), getRequestContext().getLocale()));
            out.write("</script>");
            return EVAL_PAGE;
        }
        catch (IOException e) {
            throw new JspException("Could not write validation rules", e);
        }
View Full Code Here

        return SKIP_BODY;
    }

    public int doEndTag() throws JspException {
        try {
            JspWriter out = pageContext.getOut();
            if (includeScriptTags) {
                out.write("<script type=\"text/javascript\">\n");
            }
            copy(ValangJavaScriptTranslator.getCodebaseReader(), out);

            if (globalErrorsId != null) {
                out.write("ValangValidator.prototype.globalErrorsId = '" + globalErrorsId + "';\n");
            }
            if (fieldErrorIdSuffix != null) {
                out.write("ValangValidator.prototype.fieldErrorIdSuffix = '" + fieldErrorIdSuffix + "';\n");
            }
            if (logId != null) {
                out.write("ValangValidator.Logger.logId = '" + logId + "';\n");
            }
            if (includeScriptTags) {
                out.write("\n</script>");
            }
            return EVAL_PAGE;
        } catch (IOException e) {
            throw new JspException("Could not write validation codebase", e);
        }
View Full Code Here

                if (commandName == null || commandObj == null) {
                    logger.error("Command object not found");
                    return EVAL_PAGE;
                }
            }
            JspWriter out = pageContext.getOut();
            Locale locale = getRequestContext().getLocale();
            WebApplicationContext webApplicationContext = getRequestContext().getWebApplicationContext();
            MessageSourceAccessor messages = new MessageSourceAccessor(webApplicationContext, locale);

            out.write("<script type=\"text/javascript\" id=\"" + commandName + "ValangValidator\">\n");
            cotvc.writeJS(commandName, commandObj, globalVar, validateOnSubmit, out, messages);
            out.write("\n</script>");

            return EVAL_PAGE;

        } catch (IOException e) {
            throw new JspException("Could not write validation rules", e);
View Full Code Here

     * The implementation of this method is provided by the tag library developer,
     * and handles all tag processing, body iteration, etc.
     */
    @Override
    public void doTag() throws JspException {
        JspWriter out = getJspContext().getOut();

        HttpServletRequest request = (HttpServletRequest) ((PageContext) getJspContext()).getRequest();
        String line, requestBody = "", method;
       
        controller.setHttpRequest(request);
View Full Code Here

    StringBuffer results = new StringBuffer("<a href=\"");
    results.append(response.encodeURL(url.toString()));
    results.append("\">");

    // Print this element to our output writer
    JspWriter writer = pageContext.getOut();
    try {
        writer.print(results.toString());
    } catch (IOException e) {
        throw new JspException
        (messages.getMessage("linkUser.io", e.toString()));
    }
View Full Code Here

     */
    public int doEndTag() throws JspException {


    // Print the ending element to our output writer
    JspWriter writer = pageContext.getOut();
    try {
        writer.print("</a>");
    } catch (IOException e) {
        throw new JspException
            (messages.getMessage("link.io", e.toString()));
    }

View Full Code Here

  }

  @Test
  public void testPrintGotoFormWritesValidXML() throws IOException,
         ParserConfigurationException, SAXException {
    JspWriter mockJspWriter = mock(JspWriter.class);
    ArgumentCaptor<String> arg = ArgumentCaptor.forClass(String.class);
    doAnswer(new Answer<Object>() {
      @Override
      public Object answer(InvocationOnMock invok) {
        Object[] args = invok.getArguments();
View Full Code Here

    Assert.assertEquals(dnDesc1, live.get(1));
  }
 
  @Test
  public void testPrintMethods() throws IOException {
    JspWriter out = mock(JspWriter.class);     
    HttpServletRequest req = mock(HttpServletRequest.class);
   
    final StringBuffer buffer = new StringBuffer();
   
    ArgumentCaptor<String> arg = ArgumentCaptor.forClass(String.class);
View Full Code Here

    *
    **/

    public int doEndTag() throws JspException
    {
        JspWriter out = pageContext.getOut();

        try
        {
            out.print("</a>");
        }
        catch (IOException ex)
        {
            throw new JspException(
                Tapestry.format("AbstractLinkTag.io-exception", ex.getMessage()));
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.JspWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.