This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes taglib encapsulate html elements - combobox - dropdown list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "taglib encapsulate html elements - combobox - dropdown list" Watch "taglib encapsulate html elements - combobox - dropdown list" New topic
Author

taglib encapsulate html elements - combobox - dropdown list

Seba Lenoir
Greenhorn

Joined: Jan 17, 2003
Posts: 5
Hello,
I would like to do a simple basic tag that can encapsulate the behavior
of a html combobox.
I though about something like a simple Java class that would have
2 fields: a list and a selecteditem.
When we give a reference to an instance of such a class in the jsp,
the taglib would render this html element.
<myTagLib:combobox name="myBean" property="myCombobox"/>

my first question is:
- Is there some basic class that my custom tag can extend to
handle usual attributes like 'name', 'property', 'id', ...
without having to re-develop theses funcionalities
- Is there some generic taglib open source that encapsulate all html elements
in a framework independently way?

All hints are welcomes

Seba
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
My advice is to look into Struts and their html taglib. However, if you don't want to use it, the source is at least available so you can see how they did it.
Struts homepage:
http://jakarta.apache.org/struts/
Struts HTML Taglib:
http://jakarta.apache.org/struts/struts-html.html
Note that there's also a Frameworks forum here where people discuss frameworks such as Struts.


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Seba Lenoir
Greenhorn

Joined: Jan 17, 2003
Posts: 5
oki
The purpose to avoid diving into struts code.
But I think it's indeed a good alternative.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Check out chapter 8 of my book, Professional JSP Tag Libraries (available to download from http://www.simongbrown.com) as this shows you how to build such a custom tag.
Simon
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: taglib encapsulate html elements - combobox - dropdown list
 
Similar Threads
HTTP Status 404 - Servlet action is not available
jsp custom tag issues
s:radio and display tag
jCombobox itemdata trouble
individual choice in combobox with struts