• velocity


    Ok, lets start off with some easy examples. These examples really do not even touch on the basics of correct design. However, they still make good examples because correct design is often harder than showing a simple example. We will show better examples further along in this essay.

    For the first example, we show that there are two different approaches of doing the same exact thing using both JSP and Velocity. This is an example of printing out a parameter with JSP:

    <html>
    <head><title>Hello</title></head>
    <body>
    <h1>
    <%
    if (request.getParameter("name") == null) {
       out.println("Hello World");
    }
    else {
      out.println("Hello, " + request.getParameter("name"));
    }
    %>
    </h1>
    </body></html>

    This is an example of doing the same thing with Velocity:

    <html>
    <head><title>Hello</title></head>
    <body>
    <h1>
    #if ($request.getParameter("name") == null)
       Hello World
    #else
       Hello, $request.getParameter("name")
    #end
    </h1>
    </body></html>
  • 相关阅读:
    VUE 入门基础(2)
    VUE 入门基础(1)
    常用正则表达式
    git 常用命令
    JavaScript 常用算法
    SVG 使用
    移动前端头部标签(HTML5 meta)
    开发常用小demo 整理
    Reactjs 入门基础(三)
    Reactjs 入门基础(二)
  • 原文地址:https://www.cnblogs.com/lexus/p/2580635.html
Copyright © 2020-2023  润新知