You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Vishnu Pillai <vi...@bh.eyi.com> on 2002/10/10 19:07:44 UTC
Template Compile
Hi,
Let me first introduce myselt. I'm a s/w engineer currently working on J2EE
technologies. I'm working in at EYME Technologies at Trivandrum in India.
Now, to the matter..
I am developing a template compiler which frees us of the overheads of
using tag libraries.
The motivationg factors for developing this compiler were:
1. To adhere to the principle that Views (or JSPs) should be readable
and maintainable by Web Page Designers (who need not know Java)
2. To avoid overheads of using jsp tag libraries
3. To have a common point of control over the User Interfaces
Ideally, a Template will have code similar to html with some TML (Template
Markup Language)
e.g.
Employee.tml
<HTML>
<BODY>
<FORM action="www.myhome.mypage">
<tag:ComboBox name="choice" iterator="$choices$" iteratorType
="iterator" varType="String"/>
<tag:Field label = "Enter score" name="score" type="Text"
value="0"/>
</FORM>
</BODY>
</HTML>
The Template Compiler preCompiles this template into an ordinary jsp.
Employee.jsp
<HTML>
<BODY>
<FORM action="www.myhome.mypage">
<TABLE>
<TR>
<TD>Enter score</TD>
<TD><INPUT type="Text" name="score" value="0"></TD>
</TR>
</TABLE>
<SELECT name="choice">
<% Iterator itr1 = (Iterator) request.getAttribute
("choices");
Employee val1 = null;
while(itr1.hasNext())
{
val1 = (Employee) itr1.next();
%>
<OPTION value="<%=val1.getCode()%>">
<%=val1.getFirstName()%></OPTION>
<%
}
%>
</SELECT>
</FORM>
</BODY>
</HTML>
If there's any mistake in the above code, kindly excuse, I've just typed it
here..
If you find this interesting, pls. contact me. I have some other ideas
too...
Warm regards,
Vishnu Pillai
______________________________________________________________________
The information contained in this communication is intended solely for the
use of the individual or entity to whom it is addressed and others
authorized to receive it. It may contain confidential or legally
privileged information. If you are not the intended recipient you are
hereby notified that any disclosure, copying, distribution or taking any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this communication in
error, please notify us immediately by responding to this email and then
delete it from your system. Ernst & Young is neither liable for the proper
and complete transmission of the information contained in this
communication nor for any delay in its receipt.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>