|
Use Custom Tag Libraries
Hi,
This could be achieved using custom tag libraries.
It is a 3 step process:-
1. Prepare a TLD file, with the details of the tag you wish to create. For example, name "roleselect" and tagclass as "myapps.trial.RoleSelect".
2. Implement the tagclass "myapps.trial.RoleSelect" extending TagSupport. You will need to implement 2 methods - doStartTag() and doEndTag(). In these methods, you may query the database for the values of roleid and use these to prepare the HTML code for Select. Finally, out put this HTML code to a JSPWriter.
3. In you JSP file, include the tag library(TLD file) by specifying the TLD file path in your taglib attribute like this:
<%@ taglib url=".. GIVE PATH OF YOUR TLD FILE .." prefix="my" %>
Then, the roleid select dropdown can be obtained by simple putting <my:roleselect /> at the appropriate place in the JSP file.
I hope that gives you some idea of how you could get started. You may need to do some more study JSP custome tags.
Regards,
JavaThinker
|