Forums Register Login

Tag Library!!!

+Pie Number of slices to send: Send
hi folks,
I read some articles that Tag Library is used to group a java code written in JSP using scriptlet and move them out of JSP into a library that a Page authour can then use as html tag fashion. why not use Java Bean to group such java code in JSP instead of Tab Library? What advantages and particulare need the Talg Libraray has over Java Bean? could you please clarify me?
thanks.
+Pie Number of slices to send: Send
Tag Library is not easy!!
There is many Tag Library in the starts
The Tag Library is to in fact is a page for the sake of the simplification jsp
+Pie Number of slices to send: Send
You could probably get any number of reasons to use custom tags over beans -- but in all honesty I have no idea what the previous poster is trying to say.
Search through this forum for previous topics on the same subject for other views.
If I get a chance later I'll enter a lengthier response, but in short for me it's all a matter of abstraction. I find that it's much easier to abstract page elements using custom tags of my own design, rather than trying to shoehorn it into beans.
While beans are great for value objects, if the abstracted elements need to generate HTML and/or Javascript output, it's bending the bean architecture a bit to produce it and render it to the JSP output buffer. The custom tag architecture is better integrated into the JSP environment, and is ideally suited to spitting out HTML and Javascript. as well as performing a whole host of other page-related functions.
Those aren't the only benefits or reasons, but they're the ones that sold me on the whole concept. I'm sure other tag enthusiasts will have their own favorite reasons.
hth,
bear
+Pie Number of slices to send: Send
Sir,
I want to know something more about Tags.. To me also it seems Tags helps in reducing the Javascripts and HTML codes in my jsp...
But is it also helpful in business logics like beans???
+Pie Number of slices to send: Send
Any Bean is also a Custom Tag, but not vice versa.
<jsp:useBean> or <comma:geneus-writeTheDate-gottenFromSybaseDatabase>
CT +:
Threading is dealt by the container.
You can access all the context values directly, i.e. request, response, session etc.
+Pie Number of slices to send: Send
although there are responses to my queries on Custom Tag, I am still not comfortable what advantages the Custom Tag has over JavaBean. I went through a couple of books and I undertand that both are used to seperate Java Code from JSP and encapsulate them and used in a HTML tag fashion. I found one of the interesting reason why Custome Tag is better choice than Java Bean is that "notion of ieteration, nesting or cooperating action is not better expressed with Java Bean" but with Custom Tag.
Also i found this JavaBeans can not interact with the JSP page: they do not have access to the request and response objects and you can't use them to perform the decision-making processes What does it mean? why can't we do iteration in JavaBeans? Why JavaBeans does not have access to request and response? could anyone please explain me in layman's term? it would be really great help. thanks.
[ October 19, 2003: Message edited by: Namaste Sathi ]
+Pie Number of slices to send: Send
 

Originally posted by Namaste Sathi:
"notion of ieteration, nesting or cooperating action is not better expressed with Java Bean" but with Custom Tag.
Also i found this JavaBeans can not interact with the JSP page: they do not have access to the request and response objects and you can't use them to perform the decision-making processes What does it mean? why can't we do iteration in JavaBeans? Why JavaBeans does not have access to request and response? could anyone please explain me in layman's term? it would be really great help. thanks.
[ October 19, 2003: Message edited by: Namaste Sathi ]


i think what that means is that you can't use JSP implicit objects like pageContext, request, response etc in JavaBean. And also, when you write JavaBean based on the specification you can't write any other methods other than getter and setter for properties. You can write other methods other getter and setter, it does not become a JavaBean but a Java Class. So to include such methods, you are better of putting such things in Custom Tag.that's my understaing. Others might want to add clarification if I am wrong here.
+Pie Number of slices to send: Send
I still have some problem with Custom Tag. while creating custom tag, we override doStartTag or doEndTag. What determines which one these method we should override?
thanks.
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1280 times.
Similar Threads
bean:message tag not working
two JSF library...
jsp tag library
How to generate HTML to display XML
JSP TagLib and Servlets or Beans??
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 23:48:23.