开发者

Automatic URL and email generation using Java

开发者 https://www.devze.com 2023-02-11 21:12 出处:网络
I want to generate an email containing a URL( to a specific Action subclass in Struts 1.3 ). Questions :

I want to generate an email containing a URL( to a specific Action subclass in Struts 1.3 ).

Questions :

  1. How to generate the email.
  2. How to create a URL开发者_运维知识库 which calls a struts action controller. ?
  3. How to hide certain jsp pages so that they cannot be called accidentally by malforming the URL ?
  4. How to call this hidden jsp page using the URL described in question 2. ?

How to approach the problem ?


  1. To generate an email, use the JavaMail API... here's an example: http://www.java-tips.org/other-api-tips/javamail/how-to-send-an-email-with-a-file-attachment.html
  2. If you want your user to call your Struts URL, just hardcode that URL in the email... for example: http://server/app/confirmation.do
  3. Your JSP files should be placed under /WEB-INF folder so that no one can accidentally browse your JSP files from the web. The only way the user can get to that resource is through your Struts actions (*.do) and the action will determine which JSP files to be displayed on the screen.
  4. There's no need to call it. When your user clicks on the Struts link you have constructed in #2, the Struts action that gets mapped to that URL will automatically handle the user request.
0

精彩评论

暂无评论...
验证码 换一张
取 消