Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using one JSP tag within another

Status
Not open for further replies.

Kindon

Programmer
Apr 19, 2001
54
US
I want to get the affect of using one JSP tag within another. Unfortunately embedding tags within tags is not valid syntax. I have a taglib with one attribute like the following:

<custom:tag1 attrib=&quot;myAttribValue&quot;/>

So what if I want to have attrib set by another JSP tag?

<custom:tag1 attrib=&quot;<custom:tag2 attrib2='myvalue'/>&quot;/>

This did not work, of course. At this point I started trying all kinds of things. I tried many variations of this:

<%! String myresult = &quot;&quot;; %>
<% myresult = &quot;%><custom:tag1 attrib='myvalue'/><%&quot;;%>

<custom:tag2 attrib=&quot;<%= myresult %>&quot;/>

I can't figure this out. If I could access the tag as an object I could get it to work. Here is an example of a bean that works:

<custom:tag1 attrib1='<%= Message.getMessage(&quot;login.title&quot;) %>'/>

You can't use <bean:message key=&quot;&quot;> here. You have to use the Message object, right.

Is there a way to access a taglib as an object? Do you know any way to get this to work?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top