Examples of JspTag


Examples of javax.servlet.jsp.tagext.JspTag

    @Test(expected = UnsupportedOperationException.class)
    public void testGetParameter() {
        JspFragment jspBody = createMock(JspFragment.class);
        JspContext jspContext = createMock(JspContext.class);
        JspTag parent = createMock(JspTag.class);
        replay(jspBody, jspContext, parent);
        JspAutotagRuntime runtime = new JspAutotagRuntime();
        runtime.setJspBody(jspBody);
        runtime.setJspContext(jspContext);
        runtime.setParent(parent);
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspTag

*/
public class ThenTag extends SimpleTagSupport {

  @Override
  public void doTag() throws JspException {
    JspTag parent = getParent();
    if (parent == null || !(parent instanceof IfElseTag)) {
      throw new JspException("Parent IfElse tag is required", null);
    }

    IfElseTag ifTag = (IfElseTag) parent;
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspTag

public class DefaultTag extends SimpleTagSupport {

  @Override
  public void doTag() throws JspException {
    JspTag parent = getParent();
    if (parent == null || !(parent instanceof SwitchTag)) {
      throw new JspException(SwitchTag.MSG_PARENT_SWITCH_REQUIRED, null);
    }

    SwitchTag switchTag = (SwitchTag) parent;
View Full Code Here

Examples of javax.servlet.jsp.tagext.JspTag

*/
public class ElseTag extends SimpleTagSupport {

  @Override
  public void doTag() throws JspException {
    JspTag parent = getParent();
    if (parent == null || !(parent instanceof IfElseTag)) {
      throw new JspException("Parent IfElse tag is required", null);
    }

    IfElseTag ifTag = (IfElseTag) parent;
View Full Code Here

Examples of org.htmlparser.tags.JspTag

        throws ParserException
    {
        String tagContents = tagData.getTagContents();
        tagData.setTagContents(
            tagContents.substring(1, tagContents.length() - 1));
        return new JspTag(tagData);
    }
View Full Code Here

Examples of org.htmlparser.tags.JspTag

        // Register the Jsp Scanner
        parser.addScanner(new JspScanner("-j"));
        parseAndAssertNodeCount(5);
        // The first node should be an HTMLJspTag
        assertTrue("Node 1 should be an HTMLJspTag", node[0] instanceof JspTag);
        JspTag tag = (JspTag) node[0];
        assertStringEquals(
            "Contents of the tag",
            "@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" ",
            tag.getText());

        // The second node should be a normal tag
        assertTrue("Node 2 should be an Tag", node[1] instanceof Tag);
        Tag htag = (Tag) node[1];
        assertStringEquals(
            "Contents of the tag",
            "jsp:useBean id=\"transfer\" scope=\"session\" class=\"com.bank.PageBean\"",
            htag.getText());
        assertStringEquals(
            "html",
            "<JSP:USEBEAN ID=\"transfer\" SCOPE=\"session\" CLASS=\"com.bank.PageBean\"/>",
            htag.toHtml());
        // The third node should be an HTMLJspTag
        assertTrue("Node 3 should be an HTMLJspTag", node[2] instanceof JspTag);
        JspTag tag2 = (JspTag) node[2];
        String expected =
            "\r\n"
                + "    org.apache.struts.util.BeanUtils.populate(transfer, request);\r\n"
                + "    if(request.getParameter(\"marker\") == null)\r\n"
                + "        // initialize a pseudo-property\r\n"
                + "        transfer.set(\"days\", java.util.Arrays.asList(\r\n"
                + "            new String[] {\"1\", \"2\", \"3\", \"4\", \"31\"}));\r\n"
                + "    else \r\n"
                + "        if(transfer.validate(request))\r\n"
                + "            ";
        assertEquals("Contents of the tag", expected, tag2.getText());

    }
View Full Code Here

Examples of org.htmlparser.tags.JspTag

        // Register the Jsp Scanner
        parser.addScanner(new JspScanner("-j"));
        parseAndAssertNodeCount(5);
        // The first node should be an HTMLJspTag
        assertTrue("Node 1 should be an HTMLJspTag", node[0] instanceof JspTag);
        JspTag tag = (JspTag) node[0];
        assertEquals(
            "Raw String of the first JSP tag",
            "<%@ taglib uri=\"/WEB-INF/struts.tld\" prefix=\"struts\" %>",
            tag.toHtml());

        // The third node should be an HTMLJspTag
        assertTrue("Node 2 should be an HTMLJspTag", node[2] instanceof JspTag);
        JspTag tag2 = (JspTag) node[2];
        String expected =
            "<%\r\n"
                + "    org.apache.struts.util.BeanUtils.populate(transfer, request);\r\n"
                + "    if(request.getParameter(\"marker\") == null)\r\n"
                + "        // initialize a pseudo-property\r\n"
                + "        transfer.set(\"days\", java.util.Arrays.asList(\r\n"
                + "            new String[] {\"1\", \"2\", \"3\", \"4\", \"31\"}));\r\n"
                + "    else \r\n"
                + "        if(transfer.validate(request))\r\n"
                + "            %>";
        assertEquals(
            "Raw String of the second JSP tag",
            expected,
            tag2.toHtml());
        assertTrue("Node 4 should be an HTMLJspTag", node[4] instanceof JspTag);
        JspTag tag4 = (JspTag) node[4];
        expected = "<%\r\n" + "%>";
        assertEquals(
            "Raw String of the fourth JSP tag",
            expected,
            tag4.toHtml());

    }
View Full Code Here

Examples of org.htmlparser.tags.JspTag

        // Register the jsp scanner
        parser.addScanner(new JspScanner("-j"));
        parseAndAssertNodeCount(1);
        //assertTrue("Node should be a jsp tag",node[1] instanceof HTMLJspTag);
        JspTag jspTag = (JspTag) node[0];
        assertEquals(
            "jsp toHTML()",
            "<% for (i=0;i<j;i++);%>",
            jspTag.toHtml());
    }
View Full Code Here

Examples of org.htmlparser.tags.JspTag

        // Register the Jsp Scanner
        parser.addScanner(new JspScanner("-j"));
        parseAndAssertNodeCount(4);
        // The first node should be an HTMLJspTag
        assertTrue("Third should be an HTMLJspTag", node[2] instanceof JspTag);
        JspTag tag = (JspTag) node[2];
        assertEquals("tag contents", "=object", tag.getText());
    }
View Full Code Here

Examples of org.htmlparser.tags.JspTag

        registerTag (new FrameSetTag ());
        registerTag (new FrameTag ());
        registerTag (new HeadingTag ());
        registerTag (new ImageTag ());
        registerTag (new InputTag ());
        registerTag (new JspTag ());
        registerTag (new LabelTag ());
        registerTag (new LinkTag ());
        registerTag (new MetaTag ());
        registerTag (new ObjectTag ());
        registerTag (new OptionTag ());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.