nested custom tags in JSP

Discussion in 'Java' started by Saurabh Singhania, Aug 21, 2003.

  1. Hi All,

    Is it possible to pass attributes to a JSP custom tag using another custom
    tag? I.e.:

    <mytag:something parm1="value1" parm2="<mytag:eek:ther/>"/>

    Works as expected if I pass a string or a JSP expression, but embedded
    custom tags are not evaluated. They are simply passed as plain text to my
    code, which is of course not very useful.

    Any help would be appreciated!

    Saurabh
     
    Saurabh Singhania, Aug 21, 2003
    #1
    1. Advertisements

  2. JSP obeys XML rules, which don't allow for a tag within another tag (by
    which I mean a tag within the < > for an opening tag).

    But, a tag can be contained by another tag (which would actually fit the
    definition of nesting), such as:

    <mytag:something parm1="value1">
    <mytag:eek:ther />
    </mytag:something>

    Or maybe:

    <mytag:something parm1="value1">
    <param>
    <name>parm2</name>
    <value><mytag:eek:ther /></value>
    </param>
    </mytag:something>


    Then your logic for mytag:eek:ther can set values that the
    mytag:something.doCloseTag can work with.
     
    Steve Claflin, Aug 24, 2003
    #2
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.