how to write jsp custom tag that can have all kind of jsp elements(not only other tags but also srci

Discussion in 'Java' started by Lukasz Indyk, Sep 22, 2004.

  1. Lukasz Indyk

    Lukasz Indyk Guest

    i want to write jsp custom tag that prints string "begin", then invokes
    all jsp instructions from it's body (instructions == other tags and
    scriplets), and then prints string "end". i've tried to write it by
    extending SimpleTagSupport class, and coding sth like that:

    public void doStartTag() throws JspException {
    JspWriter out = getJspContext().getOut();

    try{
    out.println("begin");
    getJspBody().invoke(null);
    out.println("end");
    } catch (IOException e) {
    throw new JspTagException("RuleFileTd tag exception :" +
    e.getMessage());
    }
    }

    the class with above method compiles without errors. this is a
    body-content tag of my custom tag definition in tld file i use:

    <body-content>JSP</body-content>

    but during execution of my jsp page tomcat gives me error saying that
    body-content cannot be set to JSP while using SimpleTagSupport.

    what to do now? maybe i should extend other class to write my tag? how
    to implement a tag that allows other tags and scriplets in his body?
    Lukasz Indyk, Sep 22, 2004
    #1
    1. Advertising

  2. Re: how to write jsp custom tag that can have all kind of jsp elements (not only other tags but also srciplets) in his body

    On Wed, 22 Sep 2004 14:25:19 +0200, Lukasz Indyk wrote:

    > i want to write jsp custom tag ..


    Please refrain from multi-posting Lukasz.
    <http://www.physci.org/codes/javafaq.jsp#xpost>

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.lensescapes.com/ Images that escape the mundane
    Andrew Thompson, Sep 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    618
  2. Dave
    Replies:
    0
    Views:
    443
  3. johkar
    Replies:
    4
    Views:
    479
    johkar
    Mar 13, 2007
  4. Marc Pichouron

    Search a keyword but but only on one kind of tag

    Marc Pichouron, Jan 8, 2004, in forum: Javascript
    Replies:
    0
    Views:
    87
    Marc Pichouron
    Jan 8, 2004
  5. Replies:
    1
    Views:
    108
Loading...

Share This Page