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

前端 未结 2 392
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条回答
  •  猫巷女王i
    2021-01-22 22:09

    In the accepted answer you have to explicitly unwind all the arguments in your controller. So if you have 5 fields, you have 5 of the above statements.

    I would suggest:

    context.put("request", request);
    

    Then in your template something like this:

    Is the Jump Run Heading Good? $request.getParameter("heading")

    Maybe you could write a little macro to avoid that last little bit of ugliness. You write a little helper function to loop through the request parameters names with getParameterNames() and call getParameter() on each.

提交回复
热议问题