How do I pass get request parameters to my Velocity Template to send mails

前端 未结 2 390
Happy的楠姐
Happy的楠姐 2021-01-22 21:50

I have a JSP and in that JSP I have a link which looks something like

http://mydomain.com/verify.do?email=emailid&id=123

Now when users clicks that link, it

2条回答
  •  别那么骄傲
    2021-01-22 21:57

    The solution is the Velocity context. In your backing Java class or Velocity servlet, read in the parameters and put them in the context:

    context.put("email", request.getParameter("email"));
    context.put("id", request.getParameter("id"));
    

    Then in your Velocity template you can reference them as $email and $id.

提交回复
热议问题