• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Custom Tags emitting custom tags.  RSS feed

 
Sahala Swenson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My apologies in advance if this question has been addressed in a previous topic.
Can a custom tag write custom tags as output, and have that output evaluated? Here are the reasons why I want to do this:
1) I have a collection of tags that format some non-trivial DHTML. They are given data in some form or another (Strings and Collections, mostly), and are purely responsible for presentation.
2) I have form and field tags that abstract away the HTML form, fields, naming, and initial value population.
My UI requirements necessitate interactions that require DHTML, but I absolutely don't want the form and field tags to emit DTHML. I would rather they instead emit tags that in turn handle all the DTHML rendering.
Let me know if this isn't clear.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you may need autogeneration code that will generate some custom tags. But I am sure you need to output the custom code(or auto generated beans into predefined class paths and automate your deployments to kickstart in case of this kind of auto generation).
In my mind it is getting a little complex, but you can refer to a Manning book which deals with auto-generation of code based on meta data etc.
I forgot the name of the book, but you sure can find it in Manning website.
Dan.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Sahala, no can do. Custom tags are translated to their equivalent Java code at page translation time, but emit their output at page request time. So emitting tags in the output would happen long after any oppurtunity to translate them.
Perhaps you could explore writing your tags handlers such that the their processing is abstracted in a way that allows them to 'call' each others' functionality.
 
Sahala Swenson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Custom tags are translated to their equivalent Java code at page translation time, but emit their output at page request time.

Ahhh, I was afraid you would say this.

Perhaps you could explore writing your tags handlers such that the their processing is abstracted in a way that allows them to 'call' each others' functionality.

I was about to go down such a path but I was hoping there would be a trick or two up someone's sleeve that would spare me the extra work. Time to fire up the IDE and get back to it...
Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to be the bearer of bad news.
Btw, I figured you'd end up on the Ranch sooner or later. What took you?
 
Sahala Swenson
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Sorry to be the bearer of bad news.
Btw, I figured you'd end up on the Ranch sooner or later. What took you?

"bearer"...*groan*
Yes it took me a while to actually. Suffice it to say that I've had quite a number of questions answered without actually posting a question.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have similar thinking before, after I read SCWCD Exam Study Kit, chapter 16, about custom tags invoke other custom tags, and more confuse when I prepare the tag files for SCWCD 1.4.
Nick.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!