File: index.jsp

package info (click to toggle)
libfreemarker-java 2.3.13%2Bdebian1-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 4,296 kB
  • ctags: 5,458
  • sloc: java: 42,735; xml: 1,352; jsp: 28; makefile: 14; sh: 10; python: 10
file content (32 lines) | stat: -rw-r--r-- 1,092 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<%@ taglib uri="/WEB-INF/fmtag.tld" prefix="fm" %>
<jsp:useBean id="mybean"  class="freemarker.examples.jsp.SimpleBean"/>
<jsp:useBean id="mybeanreq" class="freemarker.examples.jsp.SimpleBean" scope="request"/>
<fm:template>
<html>
  <head>
    <title>FreeMarker JSP Example</title>
  </head>
  <body>
    <h1>FreeMarker JSP example</h1>
    <hr>
    <p>
      This page is a JSP page, yet most of its contents is generated using
      a FreeMarker template. The below lines are the output of calling
      properties on a JSP-declared bean from the FreeMarker template:
    </p>
    
    <#assign mybean = page.mybean>
    <#assign mybeanreq = request.mybeanreq>
    
    <p>page: ${mybean.string}
    <#list mybean.array as item>
      <br>${item}
    </#list>
    <br>request : ${mybeanreq.string}
    
    <p><b>Note:</b> Starting from FreeMarker 2.2 you can use custom JSP tags in
       FreeMarker templates. If you want to migrate from JSP to FTL (i.e. FreeMarker templates),
       then that's probably a better option than embedding FTL into JSP pages.
</body>
</html>
</fm:template>