-1

I am creating a website for work using a Tomcat Web Application. One of the pages requires the user to enter their name, email, and phone number. From that point I need to grab the values from each field, generate a PDF, and email it to the user.

I suspect this is going to be a large chunk of Java code, so I'd rather do it by calling methods in a .class file rather than using

<% /* code here */ %>

What is the best way of going about something like this?

I am currently using an MVC approach, found here http://simple.souther.us/ar01s06.html, although I believe I am over complicating the process.

I just need to simply grab text fields, run a Java method (lots of Java code), then display "The PDF has been sent to EMAIL".

Thank you for the help.

Trent
  • 4,208
  • 5
  • 24
  • 46
  • 1
    Create an HTML form, create a servlet, configure the servlet to receive the post action, send the email on the doGet/doPost methods. Here is a simple example: http://stackoverflow.com/questions/2349633/servlets-doget-and-dopost disconsider the @EJB part of it – Jorge Campos Jul 29 '14 at 01:00
  • Between you and @recursivePointer, I was able to get my servlet running as expected. Thank you very much! – Trent Jul 29 '14 at 22:38

1 Answers1

0

You can let a servlet process the data inputted by the user from the first JSP page. Then from there you can write or call your PDF and email methods. Your methods may be called from a utility class. Just redirect the user to another JSP page displaying "The PDF has been sent to EMAIL" or an error page if something goes wrong.

lightning_missile
  • 2,821
  • 5
  • 30
  • 58