Thought I'd share this idea, to get some feedback.
While reading throught the (Tomcat) struts tag lib docs and comparing with the
tags I've already written, I thought of this idea. I think the XML specs may
already cater for this to a degree but a special case would still be required (I
think). My thoughts are that it would be nice (from a development point of view)
if we could have an extra pass on the JSP compiler which could do an intelligent
tag substitution, based on the available taglibs and the intersection of the
tags used. I'll give an example, as I'm sure that sounds a bit abstract:
In STRUTS, we have (approx):
<struts:form name="myForm" type="me.pkg.MyFormClass" >
<struts:text name="textField1" />
</struts:form>
Which renders:
<form name="myForm" action="/handlerServlet/myForm"> <!-- haven't looked in
detail at this bit -->
<input type=text name="textField1" value="whatEver the bean value was">
</form>
Our taglib uses a slightly more verbose form of the INPUT field than STRUTS as
in:
<myTag:input type="text" value="someDefault on the form, or the bean value"
/>
Finally, my proposal is:
<!-- need a default prefix / omit the prefix attribute -->
<jsp:taglib uri="myTags" prefix="default" >
<table width=100% ><td>
<form name="myForm" type="me.pkg.MyFormClass" >
<input type="text" name="textField1" />
</form>
</td>
</table>
</jsp:taglib>
In this example, the myTags taglib would have defined the FORM and the INPUT
tags. Since they are used within the <jsp:taglib> tag, then the JSP compiler ,
using the namespace of the enclosing taglib, calls the custom tags in the normal
way.
The advantage is this is that ANY html tool can be used to author and can still
be used for round trips. Also, in the tool the FORM elements will render
properly, so that authoring is much easier. I realise this moves JSP away from
vanilla XML, but the benefits and added tool support I think would be worth it.
The extra work is in the JSP compiler, but I think it would only require an
extra pass of the file at compile time (if that).
This could be used to customise the behaviour of any standard tag / you could
use a standard tag for tool support but override its default rendering..
Opinions?
Ken.
This communication is for informational purposes only. It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan & Co. Incorporated, its
subsidiaries and affiliates.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets