Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: indentation

...

Code Block
xml
xml
titleweb.xml excerpt for FreeMarker servlet
<servlet>
    <servlet-name>Freemarker</servlet-name>
    <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>

    <init-param>
        <param-name>TemplatePath</param-name>
        <param-value>/</param-value>
    </init-param>
    <init-param>
        <param-name>template_update_delay</param-name>
        <param-value>0</param-value> <!-- 0 is for dev only! Use higher value otherwise. -->
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>Freemarker</servlet-name>
    <url-pattern>*.ftl</url-pattern>
</servlet-mapping>

...

Code Block
xml
xml
titleweb.xml excerpt for Filtering FreeMarker requests
<filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <servlet-name>Freemarker</servlet-name>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>

...

Code Block
xml
xml
titleFreeMarker version of the quickstart template - index.ftl
[#ftl]
[#assign s=JspTaglibs["http://stripes.sourceforge.net/stripes.tld"]]
<html>
<head>
<title>My First Stripe</title>
<style type="text/css">
input.error { background-color: yellow; }
</style>
</head>
<body>
<h1>Stripes Calculator - FTL</h1>

Hi, I'm the Stripes Calculator. I can only do addition. Maybe, some day, a nice programmer
will come along and teach me how to do other things?

[@s.form action="/examples/quickstart/Calculator.action"]
[@s.errors/]
<table>
    <tr>
        <td>Number 1:</td>
        <td>[@s.text name="numberOne"/]</td>
    </tr>
    <tr>
        <td>Number 2:</td>
        <td>[@s.text name="numberTwo"/]</td>
    </tr>
    <tr>
        <td colspan="2">
            [@s.submit name="addition" value="Add"/]
            [@s.submit name="division" value="Divide"/]
        </td>
    </tr>
    <tr>
        <td>Result:</td>
        <td>${(actionBean.result)!}</td>
    </tr>
</table>
[/@]
</body>
</html>

...