📄 wmhello.java
字号:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.webmacro.*;
import org.webmacro.servlet.*;
public class WMHello extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
FastWriter out = new FastWriter(res.getOutputStream(),
res.getCharacterEncoding());
try {
WebMacro wm = new WM(); // optionally WM("/path/to/config/file")
Context c = wm.getWebContext(req, res);
c.put("date", new Date());
Template tmpl = wm.getTemplate("hello.wm");
tmpl.write(out, c);
out.flush();
}
catch (WebMacroException e) {
throw new ServletException(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -