|
What's the Deal with java tags in JSP and JHTML Pages?Note: The information in this article is for Dynamo 5.1 only Example CodeLet's look at an example. The server code below uses both <java> and <% %> tags, we can save the same page with both a .jsp and .jhtml extension and get different results
<HTML> <HEAD>
<TITLE>Java Server Page</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>Java Server Page</H1>
<%
int iJavaTag=0;
int iJSPTag=0;
%>
<java>
iJavaTag++;
</java>
<%
iJSPTag++;
%>
<% out.println("<br>Test JSP <java> tag: " + iJavaTag); %>
<% out.println("<br>Test JSP < % % > tag: " + iJSPTag); %>
</BODY> </HTML>
As a JHTML PageYou can effectively use the jsp tags <% and %> in a JHTML page for java code, the result of firing up our java_server_page.jhtml page is as follows: <H1>Java Server Page</H1> <BR>Test JSP <JAVA>tag: 1 <BR>Test JSP < % % > tag: 1 We see that both the <% %> and <java> tag delimited code is part of the page servlet As a JSP PageYou cannot effectively use the jhtml tags <java> in a JSP page for java code, the result of firing up our java_server_page.jsp page is as follows: <H1>Java Server Page</H1> <JAVA>iJavaTag++; </JAVA> <BR>Test JSP <JAVA>tag: 0 <BR>Test JSP < % % > tag: 1 We see that the <java> tags are not processed on the server and are passed down untouched to the client. This is because these tags are not a part of the JSP specification. SummaryFiles ending in .JHTML are processed with the JHTML tags enabled as a superset of the JSP standard. This means:
|
|