Hi all,
I'm developing a custom tag and want to use a struts tag inside my custom tag, so the struts tag is evaluated too.
Can this be done? How?
Thanks,
-
Using Struts tags inside a custom tag (13 messages)
- Posted by: Eneko Gonzalez
- Posted on: April 15 2004 03:02 EDT
Threaded Messages (13)
- Using Struts tags inside a custom tag by Paul Strack on April 15 2004 09:50 EDT
- RE: Using Struts tags inside a custom tag by Eneko Gonzalez on April 16 2004 03:11 EDT
-
RE: Using Struts tags inside a custom tag by Paul Strack on April 17 2004 04:31 EDT
-
I tried this with wlw netui taglibs but doesn't work by Neeraj Jain on April 23 2004 04:19 EDT
-
I tried this with wlw netui taglibs but doesn't work by Paul Strack on April 24 2004 11:14 EDT
-
I tried this with wlw netui taglibs but doesn't work by Neeraj Jain on April 26 2004 01:50 EDT
-
I tried this with wlw netui taglibs but doesn't work by Paul Strack on April 26 2004 10:02 EDT
-
My problem is I want to use netui tags inside my custom tags by Neeraj Jain on April 27 2004 09:24 EDT
-
My problem is I want to use netui tags inside my custom tags by Paul Strack on April 27 2004 11:07 EDT
-
My problem is I want to use netui tags inside my custom tags by Eneko Gonzalez on July 18 2004 05:34 EDT
-
Using Struts tags inside a custom tag by Deepak Raina on August 03 2004 02:29 EDT
- Using Struts tags inside a custom tag by Fernando De Leon on August 24 2004 07:12 EDT
-
Using Struts tags inside a custom tag by Deepak Raina on August 03 2004 02:29 EDT
-
My problem is I want to use netui tags inside my custom tags by Eneko Gonzalez on July 18 2004 05:34 EDT
-
My problem is I want to use netui tags inside my custom tags by Paul Strack on April 27 2004 11:07 EDT
-
My problem is I want to use netui tags inside my custom tags by Neeraj Jain on April 27 2004 09:24 EDT
-
I tried this with wlw netui taglibs but doesn't work by Paul Strack on April 26 2004 10:02 EDT
-
I tried this with wlw netui taglibs but doesn't work by Neeraj Jain on April 26 2004 01:50 EDT
-
I tried this with wlw netui taglibs but doesn't work by Paul Strack on April 24 2004 11:14 EDT
-
I tried this with wlw netui taglibs but doesn't work by Neeraj Jain on April 23 2004 04:19 EDT
-
RE: Using Struts tags inside a custom tag by Paul Strack on April 17 2004 04:31 EDT
- RE: Using Struts tags inside a custom tag by Eneko Gonzalez on April 16 2004 03:11 EDT
- Look at how Expresso does it by Kris Thompson on April 15 2004 11:08 EDT
-
Using Struts tags inside a custom tag[ Go to top ]
- Posted by: Paul Strack
- Posted on: April 15 2004 09:50 EDT
- in response to Eneko Gonzalez
It's easy.
In the Tag Library Definition for your custom tag, make the <bodycontent> "JSP". This means that the contents your tag will be evaluated as JSP logic. This includes evaluating any other tags inside of yours. -
RE: Using Struts tags inside a custom tag[ Go to top ]
- Posted by: Eneko Gonzalez
- Posted on: April 16 2004 03:11 EDT
- in response to Paul Strack
make the <bodycontent> "JSP".
I have it, but it doesn't work... I see the source (html:text) but it's not translated... any idea? -
RE: Using Struts tags inside a custom tag[ Go to top ]
- Posted by: Paul Strack
- Posted on: April 17 2004 16:31 EDT
- in response to Eneko Gonzalez
Are you sure that you are importing the Struts taglib as well as your own taglib? -
I tried this with wlw netui taglibs but doesn't work[ Go to top ]
- Posted by: Neeraj Jain
- Posted on: April 23 2004 16:19 EDT
- in response to Paul Strack
WLW netui tabligs are extensions to struts taglibs and i included netui tablibs and my custom taglib both. It doesn't work, kindly suggest. -
I tried this with wlw netui taglibs but doesn't work[ Go to top ]
- Posted by: Paul Strack
- Posted on: April 24 2004 23:14 EDT
- in response to Neeraj Jain
Can you provide more information? What tags are you nesting inside others? What happens you view source on the rendered page? -
I tried this with wlw netui taglibs but doesn't work[ Go to top ]
- Posted by: Neeraj Jain
- Posted on: April 26 2004 13:50 EDT
- in response to Paul Strack
JAVA CODE ---------------
package com.bms.pri.cso.crq.tag_handlers;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
public class DateControl extends javax.servlet.jsp.tagext.TagSupport
{
private String title = "";
private String dataSource = "";
private String styleClass = "";
public void setTitle(String title)
{
this.title = title;
}
public void setDataSource(String dataSource)
{
this.dataSource = dataSource;
}
public void setStyleClass(String styleClass)
{
this.styleClass = styleClass;
}
public int doStartTag() throws JspException
{
try
{
pageContext.getOut().print("<netui:textBox tagId='" + title + "' styleClass='" + styleClass + "' dataSource='" + dataSource + "' />");
}
catch (Exception e)
{
throw new JspTagException(e.getMessage());
}
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException
{
try
{
pageContext.getOut().print("");
}
catch (Exception e)
{
throw new JspTagException(e.getMessage());
}
return EVAL_PAGE;
}
}
Part of the JSP Code where i am invoking this custom tag
<%@ taglib uri="netui-tags-html.tld" prefix="netui"%>
<!-- including the taglib where the path of the particular taghandler is defined-->
<%@ taglib uri="taglib.tld" prefix="crq-custom"%>
<crq-custom:DateControl title="effectiveFromDate" styleClass="textBoxStyle" dataSource="{actionForm.effectiveFromDate}"/>
HTML that is getting rendered
<netui:textBox tagId='effectiveFromDate' styleClass='textBoxStyle' dataSource='{actionForm.effectiveFromDate}' /> -
I tried this with wlw netui taglibs but doesn't work[ Go to top ]
- Posted by: Paul Strack
- Posted on: April 26 2004 22:02 EDT
- in response to Neeraj Jain
Here is your problem:pageContext.getOut().print("<netui:textBox tagId='" + title + "' styleClass='" + styleClass + "' dataSource='" + dataSource + "' />");
A custom tag must be embedded in the JSP page itself, so that the JSP compiler can convert it to the appropriate calls to the tag handler class.
Your DateControl logic is completely broken. You will be better off using the <netui:textBox> tag directly. -
My problem is I want to use netui tags inside my custom tags[ Go to top ]
- Posted by: Neeraj Jain
- Posted on: April 27 2004 09:24 EDT
- in response to Paul Strack
That's fine Paul, I got your point. But problem is I want to use netui tags inside my custom tags, not only one but 2-3 netui tags so that instead of adding three netui tags on the JSP page I can add just invoke my custom tag. Please suggest if there is any way out. -
My problem is I want to use netui tags inside my custom tags[ Go to top ]
- Posted by: Paul Strack
- Posted on: April 27 2004 11:07 EDT
- in response to Neeraj Jain
Custom tags can only be invoked from a JSP.
I suggest you use some kind of JSP include if you want to set up common invocations of several tags, and re-use the include.
The only other alternative that I can think of is to get at the source code of the netui tags, and extract the Java logic into your own custom tag. -
My problem is I want to use netui tags inside my custom tags[ Go to top ]
- Posted by: Eneko Gonzalez
- Posted on: July 18 2004 17:34 EDT
- in response to Paul Strack
At last, what i've done is to use the Struts tag as a class in my Tag class. For example, if i want to use a form, what i do is:
FormTag myForm = new FormTag();
myForm.setPageContext(pageContext);
myForm.doStartTag();
myForm.doEndTag();
Perhaps you can do something like this too -
Using Struts tags inside a custom tag[ Go to top ]
- Posted by: Deepak Raina
- Posted on: August 03 2004 14:29 EDT
- in response to Eneko Gonzalez
Hi Eneko,
I'm facing a similar problem. I'm developing a custom tag and want to use a struts tag inside my custom tag, so the struts tag is evaluated too. Can you give me a example how you solved it? -
Using Struts tags inside a custom tag[ Go to top ]
- Posted by: Fernando De Leon
- Posted on: August 24 2004 19:12 EDT
- in response to Deepak Raina
I am having the same problem.
i created a custom tag as such..
<contactPerson:displayName uniqueIdentifier="<bean:write name='calendarEvent' property='desContactPerson'/>"/>
when I load the jsp page it does not evaluate the inner tag?!
However when I do this..
<contactPerson:displayName uniqueIdentifier=<bean:write name='calendarEvent' property='desContactPerson'/>/>
It evaluates the inner tag but it does evaluate my custom tag?!
also when i do this
<contactPerson:displayName uniqueIdentifier='<bean:write name='calendarEvent' property='desContactPerson'/>'/>
Same as above..it only evaluates my inner tag but not my custom tag :(
AND..to finish off when i do
<contactPerson:displayName uniqueIdentifier="<bean:write name="calendarEvent" property="desContactPerson"/>"/>
It only evaluates the inner tag but not my custom tag... >:(
This is a section of the tld file for my custom tag...
<tag>
<name>displayName</name> <tagclass>au.gov.qld.des.portal.calendar.taglib.ContactUserDisplayNameTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>Display User info tag base on uniqueIdentifier from phonebook</info>
<attribute>
<name>uniqueIdentifier</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
Is it possible at all to do it...or must we rely on using scriptlet?! -
Look at how Expresso does it[ Go to top ]
- Posted by: Kris Thompson
- Posted on: April 15 2004 11:08 EDT
- in response to Eneko Gonzalez
The Expresso web framework is largely an extension of Struts including their tags. It is opensource so you can go download it and check it out. www.jcorporate.com