Forums Register Login

custom tags (taglib)

+Pie Number of slices to send: Send
Greetings from Australia.
I am designing a JSP app using custom-tags to control content. (MVC framework would be overkill)
I prefer to have no java code in my JSP pages,
just custom-tags and html.
One of my tags will validate usr/pwd against a mysql database.
I would like to establish a connection pool,
just as I would in init(), if I were using a servlet.
However, it appears that custom-tag classes (extends BodyTagSupport) are instantiated each time the jsp page is loaded.
Does anybody have any suggestion on how I can use connection pooling with my custom tag classes ??
(and keep java content in my JSP page to a minimum)
Thanks in advance
+Pie Number of slices to send: Send
Place the reference to your DB Pool Class in the ServletContext. You can use a tag to ensure it is setup or have a standard call in each tag where you need a connection. Use code similar to
+Pie Number of slices to send: Send
Thanks Carl,it worked a treat.
Just one question re JSP from a newbie...
Is it bad form to put all java code inside
custom tags and use the JSP as display-only.
+Pie Number of slices to send: Send
Form is established by the Company and developer. Probably, the best form is to have your JSP strictly tags. It's easier at that point to ship the HTML development to someone with this expertise.
+Pie Number of slices to send: Send
Ron,
If your preference is tags, take a good look at the jakarta tag library. It has some useful tags to do some pretty mundane things.
Also, take a peek at a new library called dotJ - http://www.dotjonline.com
The grid tag and the HTML form tags are pretty cool.
Good luck ...
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1125 times.
Similar Threads
How volume 2 will deal with custom tags?
Body content of Simple tsg
Problem with custom tags
Can a custom tag return a jsp tag?
Please provide hint.
More...

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