Hanmay Udgiri wrote:
I could not get both Dave and Scott
Can u explain more briefly
I don't think I can get any more brief than my original post. Your issue seems to be that you're unable to use tags from your custom Java tag. My response was, don't use a custom Java tag. Use a JSP-based tag instead.

Instead of creating your tag using a Java class, you should create your tag using a JSP file. Let's say we had a tag called "greeting", and it took a message key as a parameter. We'll call the parameter "key", for consistency's sake. The tag would print "Greetings!", followed by a message from a property. We would create a new file called "greeting.tag", and place it in the "WEB-INF/tags" directory (the file looks very much like a regular JSP file):

---[ Start file WEB-INF/tags/greeting.tag ]---

<%@ taglib uri=/tags/struts-bean" prefix="bean" %>
<%@ page language="java" %>

<%@ attribute name="key" required="true" type="java.lang.String" %>

<p>Greetings!</p>
<p>
 <bean:message key="${key}" />
</p>

---[ End file ]---

Then we need to use this in our JSP, by importing the whole tags/ subdirectory at the top:

<%@ taglib tagdir="/WEB-INF/tags" prefix="mytags" %>

And then later on in the file, we might have something that checks the time and uses a certain message key when it's morning:

<mytags:greeting key="msg.greeting.morning" />

By using a JSP file instead of a Java file for the tags, you can use the JSP syntax, the JSTL, all your tags, etc., instead of being stuck with the Java language and having to embed all your tags (and not be able to use stuff like <bean:message...> as is within your custom tag).

- Scott



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to