nested custom tags in JSP

S

Saurabh Singhania

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
 
S

Steve Claflin

Saurabh said:
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

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top