This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes custom import tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » JSP
Bookmark "custom import tag" Watch "custom import tag" New topic

custom import tag

Roel De Nijs

Joined: Jul 19, 2004
Posts: 7237

i have 3 jsp-files: a.jsp, b.jsp and c.jsp

a.jsp contains:
<c:import url="b.jsp" />

b.jsp contains:
<c:import url="c.jsp" />

c.jsp contains some text and other struts-stuff

when i display a.jsp it's properly compiled and i get all the information that's needed (so the import in b.jsp is completed succesfully)

now i made a new tag in my own taglibrary because it has to do some things extra before import could happen.


public class Import extends ImportTag { // some getters and setters public int doStartTag() throws JspException { // some stuff to determine the url super.setUrl(url); return super.doStartTag(); } public int doEndTag() throws JspException { return super.doEndTag(); }}


in my tld i've got this entry:


<tag><name>import</name><tagclass>be.aquafin.webgis.struts.tag.Import</tagclass><bodycontent>JSP</bodycontent><attribute> <name>pagina</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>naamObject</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag>


when i have the same situation as above but instead of c:import i have aqf:import and other params that has to give in theory the same result as above, it doesn't import the import in b.jsp . so i get instead "<aqf:import param1="" param2="" />" as text in the jsp-file

when i change the import in a.jsp to <aqf:import ...> and in the b.jsp i don't change a thing it works also properly, also other struts-tags like logic:equal are succesfully managed.

Anyone with an idea how to get my own import-tag to get some iteration in importing ?

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63208

o i get instead "<aqf:import param1="" param2="" />" as text in the jsp-file

If the tag is being sent to the browser uninterpreted, the most likely cause is that you have not properly declared the aqf tag library on the page.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Roel De Nijs

Joined: Jul 19, 2004
Posts: 7237

Yeah, i forgot idd the declaration of my own taglib in this jsp-file

Thanks for pointing me in the right direction because else i would now be and
I agree. Here's the link:
subject: custom import tag
jQuery in Action, 3rd edition