Before I get started with my question, here are my unfortunate limitations:
- I'm using JSF 1.2, not 2; so no composite component.
- I'm using JSP for rendering instead of facelets; so none of those composite components either.
- I'm not allowed to use any 3rd-party tag libraries (richFaces, iceFaces, etc.)
These limitations are set in stone.
Now moving onto my question. Currently, we have a JSP subview
which handles creating an address. There is a lot of javascript that goes along with this, along with a backing bean. This page is never used directly. Instead, it's included using a <jsp:include />
.
However, there are several attributes that I want to be able to change. For instance, is county required, are we currently doing address scrubbing, etc. In order to do this, it would make sense to use a custom component (I think?). However, I'm not really sure the best way to do this.
If I could, I would simply turn this JSP into a composite component and be done with it. However, that's not really an option based on my limitations.
What are my options? This wouldn't be so difficult if it weren't for the amount of javascript involved. I know my explanation was vague; however, I'm looking more for guidance than a direct answer. I've googled for things such as custom JSF 1.x components with javascript, etc. I haven't found many good articles, however.
Thanks in advance.
Create a JSP tag file.
/WEB-INF/tags/foo.tag
Declare and use it as follows (no additional XML configuration necessary):
Note that JSTL is also here a "view build time" tag like as in Facelets. Also note that you can't use
#{}
to reference JSP tag attributes.