I want to generate an email containing a URL( to a specific Action subclass in Struts 1.3 ).
Questions :
- How to generate the email.
- How to create a URL开发者_运维知识库 which calls a struts action controller. ?
- How to hide certain jsp pages so that they cannot be called accidentally by malforming the URL ?
- How to call this hidden jsp page using the URL described in question 2. ?
How to approach the problem ?
- 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
- If you want your user to call your Struts URL, just hardcode that URL in the email... for example: http://server/app/confirmation.do
- 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. - 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.
精彩评论