GeeCON Prague 2014*
The moose likes Servlets and the fly likes Servlet via URL in Email - Suggestions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet via URL in Email - Suggestions?" Watch "Servlet via URL in Email - Suggestions?" New topic
Author

Servlet via URL in Email - Suggestions?

K DeLucia
Ranch Hand

Joined: Apr 11, 2008
Posts: 68
I'm working on an application that uses jsp and html pages and servlets. Basically, a user logs in, fills out a request form and submits it. On submit a servlet kicks off that saves the request details in an Oracle table and sends an email. That email is picked up by another system where there is some internal routing of the request document and the status in the Oracle table is updated. Once that is complete, I want to send an email back to the original requestor so they can see a status of their request and click 'approve' or 'deny'.

I'm at the point where I'm trying to figure out how to display the request and its status to the requestor. I don't have a problem with the servlet that will pull the appropriate data to display for the user, but I'm not sure of the best way to get the user to the page they need to be at.

For instance, (and I'm very new to java so these may very well not be the best ways) I think I could send a url such as http://myhost/rfs/MyServlet which will kick off the servlet to pull the data from Oracle to display. I'm not sure though how to pass in the 'Request#' which is my key for looking up the request. Can the url be appended with ?reqnum=myreqnum? And if so, is this a good way to handle it?

Another option could be to send a url such as http://myhost/rfs/mypage.html and have some onload javascript run to kick off the servlet and displays the appropriate data to the user. This seems like an extra step that is relying on javascript which may or may not be enabled.

Am I going about this the right way? Any suggestions as to how I should go about this are most appreciated!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42055
    
  64
JavaScript seems like an unnecessary complication. There's no problem with emailing an URL like http://myhost/rfs/MyServlet?reqnum=myreqnum&foo=bar


Ping & DNS - my free Android networking tools app
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Yes, the query string is one means by which you can attach the data. Or, you can investigate the use of "friendly URLs" in which the info is embedded in the path info.

In either case, be sure that you are not introducing security issues by exposing actual ID values. be sure to use indirect methods or encryption.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Servlet via URL in Email - Suggestions?