Oracle JavaServer Pages Developer's Guide and Reference
Release 8.1.7

Part Number A83726-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

Custom Tag Samples

This section includes the following:

JML Tag Sample--hellouser_jml.jsp

This section provides a basic sample using some of the Oracle JML custom tags.

This is a modified version of the hellouser.jsp sample provided earlier in this chapter. For contrast, both the JML code and the original code are provided here.

Note that the runtime implementation of the JML tag library is portable to other JSP environments. For an overview of the runtime implementation, see "Overview of the JSP Markup Language (JML) Sample Tag Library". For information about the compile-time (non-portable) implementation, see Appendix C, "Compile-Time JML Tag Support".

Code for hellouser_jml.jsp (using JML tags)

<%-----------------------------------------------------------
   Copyright (c) 1999, Oracle Corporation. All rights reserved.
------------------------------------------------------------%>

<%@page session="false" %>
<%@ taglib uri="WEB-INF/jml.tld" prefix="jml" %>

<jml:useForm id="name" param="newName" scope="request" />

<HTML>
<HEAD>
<TITLE>
Hello User
</TITLE>
</HEAD>

<BODY>

<jml:if condition="!name.isEmpty()" >
<H3>Welcome <jml:print eval="name.getValue()" /></H3>
</jml:if>

<P>
Enter your Name:
<FORM METHOD=get>
<INPUT TYPE=TEXT name=newName size = 20><br>
<INPUT TYPE=SUBMIT VALUE="Submit name">
</FORM>

</BODY>
</HTML>

Code for hellouser.jsp (not using JML tags)

<%-----------------------------------------------------------
   Copyright (c) 1999, Oracle Corporation. All rights reserved.
------------------------------------------------------------%>

<%@page session="false" %>

<jsp:useBean id="name" class="oracle.jsp.jml.JmlString" scope="request" >
      <jsp:setProperty name="name" property="value" param="newName" />
</jsp:useBean>

<HTML>
<HEAD>
<TITLE>
Hello User
</TITLE>
</HEAD>

<BODY>

<% if (!name.isEmpty()) { %>
<H3>Welcome <%= name.getValue() %></H3>
<% } %>

<P>
Enter your Name:
<FORM METHOD=get>
<INPUT TYPE=TEXT name=newName size = 20><br>
<INPUT TYPE=SUBMIT VALUE="Submit name">
</FORM>

</BODY>
</HTML>

Pointers to Additional Custom Tag Samples

Additional custom tag samples are provided elsewhere in this document:



Go to previous page
Go to beginning of chapter
Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index