LOL! This stuff cracks me up.

:-)

I removed the attachment. You can get it from the WM mailing list or email
that guy if you are really interested.

p.s. JSP sucks. :-)

-jon

----------
From: "Jonathon Lipsky" <[EMAIL PROTECTED]>
Organization: Roland Berger & Partner
Reply-To: "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]>
Date: Wed, 12 Jul 2000 17:20:51 +0200
To: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
Subject: [Webmacro] Using webmacro with JSP (Includes Example)

Hello,

I figure I'm not the only one who might want to do this, so I thought I
would send everyone the simple taglet I have developed that allows you to
embed a webmacro template in a JSP file.  I havn't tested it very much so I
make no guarantees, but it has worked fine for me so far.

Basically, the way it works is that you add a hashtable (which is your
context containing everything for your template) to the page, request,
session or application. The taglet has two different attributes you can set
to control where the taglet gets the context from.  The first attribute is
"context".  This is the name of the hashtable variable to get from the
page, request, session or application.  (By default it will look for a
value called "context").  The second attribute is "scope" that allows you
to define if the hashtable value comes from the page, request, session or
application.   (By default it will look in the page for the value.) The
valid values for scope are "page","request","session", and "application".
The template that needs to be parsed should be included between the
beginning and ending tags.

Below is an example JSP page.

--------------- BEGIN EXAMPLE ---------------
<%@ page import="java.util.*" %>
<%@ taglib uri="/wm-tags.jar" prefix="wm" %>
<%
   Hashtable vHash = new Hashtable();
   vHash.put("test_value","This is the test value.");
   pageContext.setAttribute("test_context",vHash);
%>
<html>
<head>
  <title>Webmacro JSP Taglib Example</title>
</head>
<body>
  This example shows how to use a Webmacro from within a JSP Page.<br>
  <br>
  <wm:template context="test_context">
    $test_value
  </wm:template>
</body>
</html>
--------------- END EXAMPLE ---------------

When this JSP page is executed it will output "this is the test value" in
place of "$test_value" like it would if you used the normal WebMacro
servlet framework to parse the template.

I have attached the source code for the taglet as well as the the source
code for the example html file.  Also included is the jar file for the
taglib with the taglib.tld file already created.

At some point I plan to expand this to be able to include templates from a
file, however I don't currently have a need for it so I havn't spent the
time to do it yet...

Regards,
Jon Lipsky



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to